WebGL Assertion Failed: undefined

Having an issue with WebGL where the game starts to load up, but then errors out with the most ambiguous error. I have built out the game with a scene with a single image in it and it ran without a hitch, but when I run the scenes of my game, it aborts. I’m at a loss at this point, so I’m reaching out.

Below is the JSConsole log:

run() called, but dependencies remain, so not runningUnityLoader.js:141:2

pre-main prep time: 1639 msUnityLoader.js:141:2

PlayerConnection initialized from (debug = 0)UnityLoader.js:137:3
PlayerConnection disabled - listening mode not supportedUnityLoader.js:137:3
Initialize engine version: 5.4.1f1 (649f48bbbf0f)UnityLoader.js:137:3
Creating WebGL 1.0 context.UnityLoader.js:137:3
Renderer: MozillaUnityLoader.js:137:3
Vendor: MozillaUnityLoader.js:137:3
Version: WebGL 1.0UnityLoader.js:137:3
GLES: 0UnityLoader.js:137:3
ANGLE_instanced_arrays GL_ANGLE_instanced_arrays EXT_blend_minmax GL_EXT_blend_minmax EXT_color_buffer_half_float GL_EXT_color_buffer_half_float EXT_frag_depth GL_EXT_frag_depth EXT_sRGB GL_EXT_sRGB EXT_texture_filter_anisotropic GL_EXT_texture_filter_anisotropic OES_element_index_uint GL_OES_element_index_uint OES_standard_derivatives GL_OES_standard_derivatives OES_texture_float GL_OES_texture_float OES_texture_float_linear GL_OES_texture_float_linear OES_texture_half_float GL_OES_texture_half_float OES_texture_half_float_linear GL_OES_texture_half_float_linear OES_vertex_array_object GL_OES_vertex_array_object WEBGL_color_buffer_float GL_WEBGL_color_buffer_float WEBGL_compressed_texture_s3tc GL_WEBGL_compressed_texture_s3tc WEBGL_depth_texture GL_WEBGL_depth_texture WEBGL_draw_buffers GL_WEBGL_draw_buffers WEBGL_lose_context GL_WEBGL_lose_context MOZ_WEBGL_lose_context GL_MOZ_WEBGL_lose_context MOZ_WEBGL_compressed_texture_s3tc GL_MOZ_WEBGL_compressed_texture_s3tc MOZ_WEBGL_depth_texture GL_MOZ_WEBGL_deptUnityLoader.js:137:3
h_textureUnityLoader.js:137:3
OPENGL LOG: Creating OpenGL ES 2.0 graphics device ; Context level <OpenGL ES 2.0> ; Context handle 1UnityLoader.js:137:3
OnLevelWasLoaded was found on AudioManager
This message has been deprecated and will be removed in a later version of Unity.
Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed
Stacktrace is not supported on this platform.
e3630d3f-c40a-451b-96fd-c75e8ab8a6fc:8940:3
OnLevelWasLoaded was found on GameStatus
This message has been deprecated and will be removed in a later version of Unity.
Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed
Stacktrace is not supported on this platform.
e3630d3f-c40a-451b-96fd-c75e8ab8a6fc:8940:3
UnloadTime: 0.670000 msUnityLoader.js:137:3
Assertion failed: undefinedUnityLoader.js:137:3
Assertion failed: undefinedUnityLoader.js:141:2

warning: a problem occurred in builtin C++ name demangling; build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demanglingUnityLoader.js:141:2

Invoking error handler due to
uncaught exception: abort(“Assertion failed: undefined”) at jsStackTrace@blob:https://shff.com/e3630d3f-c40a-451b-96fd-c75e8ab8a6fc:1056:12
stackTrace@blob:https://shff.com/e3630d3f-c40a-451b-96fd-c75e8ab8a6fc:1070:21
abort@blob:https://shff.com/e3630d3f-c40a-451b-96fd-c75e8ab8a6fc:5839653:43
assert@blob:https://shff.com/e3630d3f-c40a-451b-96fd-c75e8ab8a6fc:364:3
Pointer_stringify@blob:https://shff.com/e3630d3f-c40a-451b-96fd-c75e8ab8a6fc:635:3
_SocketCreate@blob:https://shff.com/e3630d3f-c40a-451b-96fd-c75e8ab8a6fc:11702:12
_SocketCreate__wrapper@blob:https://shff.com/224ba105-a56e-4d8a-9b27-30ab350ff939:5828407:1
dynCall_ii@blob:https://shff.com/224ba105-a56e-4d8a-9b27-30ab350ff939:5820860:1
invoke_ii@blob:https://shff.com/e3630d3f-c40a-451b-96fd-c75e8ab8a6fc:17237:10
_WebSocket_SocketCreate_m2665413927@blob:https://shff.com/224ba105-a56e-4d8a-9b27-30ab350ff939:5281703:1
dynCall_iiii@blob:https://shff.com/224ba105-a56e-4d8a-9b27-30ab350ff939:5797438:1
in[…]

looking at Pointer_stringify implementation, it seems you are running out of memory in the Unity Heap. Could you try to increase WebGLMemorySize ?

That was the magic solution. Broke through that error.

  • Increased memory from 512mb to 1024mb
  • Turned on Data Caching
  • Reduced Exceptions from full to Explicitly Thrown only

Landed into another error though (Websockets). I will create another thread for it. If any one hitting this thread is willing to help me figure this out, the thread url is: https://forum.unity3d.com/threads/websocket-url-is-invalid.440626/

I just need to warn you that 1024mb will cause other memory issues on 32-bit browsers, so you will need to optimize memory consumption. Ideally, you should stay below 512mb.

Thanks for the tip.