I’m trying to switch to a new Page when the user clicks on a button in Unity to bring them to a webpage with some extra controls. So far I have the callback into the XAML C# file working - I create the new Page which I’ve templated with XAML and the WebView displays alright. However I get this player log warning:
This is the code I’m using:
private async void WebViewRequested()
{
if (appCallbacks.RunningOnUIThread())
{
System.Diagnostics.Debug.WriteLine("WebViewRequested");
WebViewPage webViewPage = new WebViewPage(WebViewClosed);
Window.Current.Content = webViewPage;
Window.Current.Activate();
appCallbacks.InvokeOnAppThread(() =>
{
appCallbacks.UnityPause(1);
}, false);
}
else
{
appCallbacks.InvokeOnUIThread(() =>
{
System.Diagnostics.Debug.WriteLine("WebViewRequested");
WebViewPage webViewPage = new WebViewPage(WebViewClosed);
Window.Current.Content = webViewPage;
Window.Current.Activate();
}, false);
appCallbacks.UnityPause(1);
}
}
Is this the right way to go about this? I’m confused why it’s warning me about running in the App thread, as the above code seems to check which thread and executes directly in the case that it’s on the appropriate thread…?
Occasionally the whole thing will just freeze up and never open the page so I’m not sure I’m doing this right or if it’s a bug.