User avatar
aliagha.huseynli
Topic Author
Posts: 44
Joined: 29 Mar 2023, 10:17

Error: Unknown element type WebView2

11 May 2023, 10:09

Hi,
I wanna use WebView2 package in unity for my project with noesis gui however i got error. How can I fix it? Thanks in advance.

In blend side I installed webview2 from nuget then I added few lines of code on xaml side:
<UserControl x:Class="WpfApp3_with_Unity.WpfApp3_with_UnityMainView"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:webview2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf">


    <Grid Width="1280" Height="800">
        <webview2:WebView2 Source="https://www.youtube.com"/>
    </Grid>
</UserControl>
Image
Image
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: Error: Unknown element type WebView2

12 May 2023, 11:12

Hi,

Nuget packages are only visible for the Blend project and won't be available for Unity. And even if you copy the nuget assemblies to the Unity project, they need to be compatible with Unity (not using APIs that are not available in netstandard 2.1).

There were in the past projects like uWebKit that brought WebView into Unity but they seem to be discontinued.
Other customers are just using the native implementation for each platform as an outside process: viewtopic.php?p=5414&hilit=webview#p5397
Could that work for you?

Who is online

Users browsing this forum: No registered users and 55 guests