gree / unity-webview

zlib License
2.27k stars 687 forks source link

webgl load - unload Scene produces error #1065

Open nitroman123 opened 6 months ago

nitroman123 commented 6 months ago

this is the error that i face image

also a problem with the margings while i set it to 190 from the top (190 doesnt change) it keeps giving me a small gap

image

KojiNakamaru commented 6 months ago

For example, if we add "Next Scene" and modified SampleWebView.cs as below, it works okay. I tested it for 2022.3.14f1.

diff --git a/sample/Assets/Scripts/SampleWebView.cs b/sample/Assets/Scripts/SampleWebView.cs
index faabee0..997f4f2 100644
--- a/sample/Assets/Scripts/SampleWebView.cs
+++ b/sample/Assets/Scripts/SampleWebView.cs
@@ -24,6 +24,7 @@ using UnityEngine;
 using UnityEngine.Networking;
 #endif
 using UnityEngine.UI;
+using UnityEngine.SceneManagement;

 public class SampleWebView : MonoBehaviour
 {
@@ -202,6 +203,11 @@ public class SampleWebView : MonoBehaviour
     {
         var x = 10;

+        if (GUI.Button(new Rect(x, 10, 80, 80), "next scene")) {
+            SceneManager.LoadScene("NextScene");
+        }
+        x += 90;
+
         GUI.enabled = (webViewObject == null) ? false : webViewObject.CanGoBack();
         if (GUI.Button(new Rect(x, 10, 80, 80), "<")) {
             webViewObject?.GoBack();

Could you please provide a modified sample app project that reproduces your issues?