Hey,
I'm trying to get a simple WebView to work on HoloLens2 using the XAML WebView. My simple setup works fine when I build for desktop UWP (set to XAML of course), however it throws an exception as soon as I instantiate a new WebView on HoloLens. So the following code already fails in an otherwise empty project, on HoloLens2 (ARM64), while it works fine on desktop (x64):
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if !UNITY_EDITOR && UNITY_WSA
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Markup;
#endif
public class Test : MonoBehaviour
{
private void NavigateToUri(Uri uri)
{
#if !UNITY_EDITOR && UNITY_WSA
WebView webView = new WebView();
#endif
}
private void TestNavigation()
{
UnityEngine.WSA.Application.InvokeOnUIThread(() =>
{
this.NavigateToUri(new Uri("http://google.com"));
}, true);
}
private void Start()
{
TestNavigation();
}
}
The exception is sadly not very helpful:
Exception: Exception of type 'System.Exception' was thrown.
at Windows.UI.Xaml.Controls.WebView..ctor () [0x00000] in <00000000000000000000000000000000>:0
at Test.NavigateToUri (System.Uri uri) [0x00000] in <00000000000000000000000000000000>:0
at Test.b__1_0 () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.WSA.AppCallbackItem.Invoke () [0x00000] in <00000000000000000000000000000000>:0
My guess is, that it has something to do with the difference in the XAML setup on HoloLens, but as I'm not experienced with that, I'd appreciate any pointers :)
Unity version: 2020.3.29f1 VS version: 2022 17.2.6
Thank you!
↧