We’ve been working on getting a successful WebGL build for quite a while now with no success.
Having tried all the various configuration/build settings, I now have a build that at least no longer produces the “out of memory” error. Now I am receiving the very informative “invalid array length” error.
This is using the latest Firefox (v38.0.1) so I dont believe it is similar to the known Chrome memory issue of “invalid typed array”.
Is there any way to get more information on what this error is referring to?
I’m getting the same error. Running “Fastest (slowest build)” mode. Firefox console output:
[16:11:00.222] syntax error @ file:///C:/Users/denisk/plastitools-webgl-out/Release/plastitools-webgl-out.js:1
[16:11:02.601] optimizing out Math.fround calls
[16:11:16.865] increasing TOTAL_MEMORY to 2164260864 to be more reasonable
[16:11:16.865] Invoking error handler due to
RangeError: invalid array length
Error building Player: IOException: Sharing violation on path C:\Program Files\Unity\Editor\Data\PlaybackEngines\webglsupport\BuildTools\WebGLTemplates\Minimal\index.html" or "C:\Users\denisk\plastitools-webgl-out\index.html
This is probably because you are setting an invalid value for WebGL memory size. Values large then 2047 or smaller then 0 result in negative 32-bit signed integer sizes of bytes, and cause an “invalid array length” error.
Unity 5.1 will make sure you can only supply valid values in this field.
That would be the issue! I was setting the memory size to 2048 in hopes of avoiding the ‘out of memory’ issue in Firefox.
Thanks very much for clarifying.
Unfortunately, now Im back to the drawing board on trying to determine what is eating up so much memory space in this build. Large functions? A couple MB of textures? More trial and error of stripping stuff away, I guess…
I m getting this (apparently same) error with Unity 5.3.
Specifics:
memory size in Player Settings: 1024
memory size in var Module.TOTAL_MEMORY: 1073741824
problem shows up on Chrome, Opera, but NOT Firefox (all on Windows 7, 64bit)
fastest build with stripping activated
js-console wont reveal much detail:
optimizing out Math.fround calls
Invoking error handler due to Uncaught RangeError: Invalid typed array length
Uncaught RangeError: Invalid typed array length
when i build with less then 2047 mb . it show error Alert memory is less
and when i use 2047 mb momery , it simply show this Alert
“An error occured running the Unity content on this page. See your browser’s JavaScript console for more info. The error was:
RangeError: invalid array length”
Because anti aliasing looks like shit even with 1000mb memory…at 512mb it’s laughable…
I’m getting this same error RangeError: Invalid Typed Array Length with a setting of 1024mb…but 1000 works, trying to figure out what the highest I can set without crashing is, and it’s nowhere near 2047mb…
I’m using Unity 5.3, the project has 17mb of textures and 30mb of meshes uncompressed in the build log, actual size is 40mb total for the build, client is complaining of anti aliasing at current settings so looking for options…
I’ve noticed:
If I limit the webGL memory to 512mb, I get 0 AA effect in builds while it looks great in the editor.
If I raise the memory allowance to 1000mb, builds show about 50% of the AA that the editor shows, I haven’t been able to get a build to not crash at 1023mb or higher. From what I’ve read custom AA doesn’t work in webgl…do you know of one that does?
Are you saying to use the profiler in Unity, or is there one in the browser? (attached image from unity’s profiler)
edit:: I’m looking through the profile for the browser console (F12) and am not quite sure what I’m supposed to be looking for…? (attached image of browser profiler as well)
i m using 64 bit browser ,
after some experiments i came to konw , one of my texture max size was grater then 4096 , when i correct it , starts working well,
but after it i start facing an other problem , unity project does not loads in browse , it just stuck …
OK, then you are using the builtin webgl anti-aliasing. So, it works if it’s supported by both browser and graphics card.
The type of AA you select (2, 4 or 8) is not actually taken into account since it depends on the browser (that’s just the way webgl works).
to know whether AA is actually enabled at runtime, try to type this in the browser console: