File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Assets/Thirdweb/Runtime/Unity/Browser Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,23 @@ public CrossPlatformUnityBrowser(string htmlOverride = null)
1616 htmlOverride = null ;
1717 }
1818
19- var go = new GameObject ( "WebGLInAppWalletBrowser" ) ;
20-
2119#if UNITY_EDITOR
2220 _unityBrowser = new InAppWalletBrowser ( htmlOverride ) ;
2321#elif UNITY_WEBGL
24- _unityBrowser = go . AddComponent < WebGLInAppWalletBrowser > ( ) ;
22+ #if UNITY_6000_0_OR_NEWER
23+ var existingBrowser = UnityEngine . Object . FindAnyObjectByType < WebGLInAppWalletBrowser > ( ) ;
24+ #else
25+ var existingBrowser = GameObject . FindObjectOfType < WebGLInAppWalletBrowser > ( ) ;
26+ #endif
27+ if ( existingBrowser != null )
28+ {
29+ _unityBrowser = existingBrowser ;
30+ }
31+ else
32+ {
33+ var go = new GameObject ( "WebGLInAppWalletBrowser" ) ;
34+ _unityBrowser = go . AddComponent < WebGLInAppWalletBrowser > ( ) ;
35+ }
2536#elif UNITY_ANDROID
2637 _unityBrowser = new AndroidBrowser ( ) ;
2738#elif UNITY_IOS
You can’t perform that action at this time.
0 commit comments