Problems with WebGL on Ipad Air 2 with Safari / Chrome / Firefox

Hello!

I’am trying to launch a webgl app using Unity and WebGL. Everything worked well until I have included RayCasting code like this:

                RaycastHit hit;
                Ray ray = mainCamera.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);

                if (Physics.Raycast(ray, out hit))
                {
}

Then WebGL stucks at 90%, all the times. Just deleting those lines and everything works again. This problem is not happening on Windows or Android.

Any idea?

Thanks in advance!

ps- Unity version Unity 2019.2.0a4 (64-bit) but the same problem happens with Unity 2018.3.5f1 (64-bit)

The problem is “Error: Out of executable memory in function at index…”, probably a bug with webkit. Apple…

Any idea?

Is that the only place you reference physics? Physics will greatly inflate your code size so it’s probably being stripping out when you delete those lines. The “Error: Out of executable memory in function at index…” error is safari’s wasm compiler running out of memory. In iOS 12.2 they doubled it making it feasible for non-trivial Unity webgl apps to work. Before 12.2, we basically could only get an empty scene to compile on iOS.

Hi kognito1.

I’ve IOS 12.2 installed and the problem seems to happen less but still happens. I will try to remove unused assemblies mannually, not sure if that will do the job :expressionless:

Does it happen after immediately opening a new tab and navigating?

It is random, sometimes never, sometimes 4-5 times before do it without errors. For now i have checked console, if “Error: Out of executable memory in function at index” is catched i just reload the scene till it load correctly.