The error above is from FireFox 53. I get this in Chrome 57.0.2987.133:
exception thrown: RuntimeError: memory access out of bounds,RuntimeError: memory access out of bounds
at ([944]+28)
at ([42281]+249)
at ([42201]+458)
at ([42196]+45)
at ([42195]+1)
at ([30326]+67)
at ([30321]+148)
at Object.UnityLoader.69624c7248aa625792505cdcc3bef985.Module._main (blob:…)
at Object.callMain
When built without WebAssembly, the build runs fine.
BTW, is there a way to disable WebAssembly even after it is built? Just removing the WASM URLs from the JSON file?
Somehow the Standard Shader got included in the build (via Graphics Settings->Always Include Shaders) which blew up the data file size to >20MB. When this is removed, the data file size is significantly smaller (1.6MB in our case) and the build seems to run fine (so far)…
UnityLoader.js?_=1493989526999:1 Invoking error handler due to
Script error.
wasm-03b8803e-27828:7 Uncaught RuntimeError: memory access out of bounds
at ([27828]+12)
at ([27826]+145)
at ([30239]+25)
at UnityLoader.47c5673658101c1a5e0e999eb44b3e52.Module._SendMessage
So it seems to happen on some SendMessage calls from javascript into Unity.
To be honest, I don’t quite recall. It may have been that we were trying to override the TOTAL_MEMORY value in the Unity loader module which isn’t allowed in WebAssembly (which is what I think Marco was getting at).
I’m also facing my problem when build and run Unity WebGL on 2 browsers and get difference results:
— Firefox: index out of bounds.
— Chrome: memory access out of bounds.
WebGLMemorySize: default 256.
Can you help me resolve my problem?
Thank you so much
Commented in the other thread webgl failed to build my project - Unity Engine - Unity Discussions . When you see an error like index out of bounds, try doing a Development build and get the callstack of where the error occurs from there. That can give a clue as to whether it is a Unity bug or a browser bug, or something else.
Unity WebGL exports are not currently tailored for mobile use, but nothing is really stopping you from doing so. If you edit the UnityLoader.js script inside Unity installation tree, you can remove the mobile WebGL unsupported notification dialog. Check out other threads in this forum for tips and recommendations on how to optimize for mobile use.