WebGLInput icon indicating copy to clipboard operation
WebGLInput copied to clipboard

Unity 2021.3.3f1 - crashes immediately

Open bitfreaks opened this issue 3 years ago • 8 comments

When compiled with this unity version and added to the InputField - just clicking on that field completely crashes the WebGL instance.

bitfreaks avatar May 31 '22 12:05 bitfreaks

Hey @bitfreaks! Only to confirm... I think this is the same issue I already opened here, right?

sandrade-dcl avatar May 31 '22 13:05 sandrade-dcl

Yeah, something similar.

bitfreaks avatar May 31 '22 13:05 bitfreaks

i was rebuild the sample with Unity2021.3.3f1. It's working fine. https://unityroom.com/games/webglinput

can i have the reproduction project? and which release version you used? the current version is 1.2.2 https://github.com/kou-yeung/WebGLInput/releases

kou-yeung avatar Jun 04 '22 12:06 kou-yeung

I used 1.2.2 - will try to re-compile it tomorrow, maybe it was a faulty build or it conflicted with cloudflare cache. Will let you know, thanks for responding!

bitfreaks avatar Jun 06 '22 19:06 bitfreaks

Unity2021.3.3f1. image

johnymaia avatar Jun 08 '22 12:06 johnymaia

So, the initial scene loads up nicely, but as soon as I click on the InputField - whole instance crashes.

image

bitfreaks avatar Jun 16 '22 12:06 bitfreaks

OK - This helped, seems it is not an error on your end! https://github.com/kou-yeung/WebGLInput/issues/90#issuecomment-1144460200

Changed my index.html: <div id="unityContainer"> After the change <div id="unity-container">

bitfreaks avatar Jun 16 '22 12:06 bitfreaks

It is definitively happening because of the name of the main div container... In my case, as I'm always using the name gameContainer for this div, I had to modify the WebGLInput code in order to set ALWAYS this name into WebGLInput.CanvasId and not others depending on the Unity version.

In my case I replaced this:

static WebGLInput()
 {
#if UNITY_2020_1_OR_NEWER
    WebGLInput.CanvasId = "unity-container";
#elif UNITY_2019_1_OR_NEWER
    WebGLInput.CanvasId = "unityContainer";
#else
    WebGLInput.CanvasId = "gameContainer";
#endif
    WebGLInputPlugin.WebGLInputInit();
}

by this:

static WebGLInput()
{
    WebGLInput.CanvasId = "gameContainer";
    WebGLInputPlugin.WebGLInputInit();
}

And it worked!

sandrade-dcl avatar Sep 09 '22 15:09 sandrade-dcl

fixed from 1.2.3

kou-yeung avatar May 11 '24 04:05 kou-yeung