WebGL port doesn't work

Hello everyone.

To make things clear, we are developing a multi-platform MMO game that currently works for webplayer, android & iOS. So, naturally, thought i give webGL unity3d port a try. The game webGL port doesn’t work. To be clear, it works perfectly on the latest unity 4.5.4f.

So, the build was done with slow-compile-heavy-optimized option. The whole generated pack of files has around 200 mb (kind of alot i think)

Here is what i get in Firefox 32:

While trying to run, i get a pop-up saying this:

n error occured running the Unity content on this page. See your browser's JavaScript console for more info. The error was:
uncaught exception: abort() at jsStackTrace@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:862:6
stackTrace@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:876:2
abort@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3407508:2
__Z46Register_UnityEngine_WebCamTexture_get_devicesv [Register_UnityEngine_WebCamTexture_get_devices()]@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:10873:2
__Z32RegisterAllStrippedInternalCallsv [RegisterAllStrippedInternalCalls()]@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:136605:2
__Z24RegisterAllInternalCallsv [RegisterAllInternalCalls()]@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3388528:2
_InitializeScriptingBackend@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3368460:2
_main@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:782906:2
asm._main@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3405477:2
callMain@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3407424:7
doRun@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3407460:4
run/<@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3407470:4

I also see that my memory allocates around 1gb ram for firefox.

i checked the javascript console and got:

Successfully compiled asm.js code (total compilation time 27911ms; stored in cache; 4 functions compiled slowly: __ZN5physx31setupFinalizeSolverConstraints4EPNS_21PxcSolverContact4DescERNS_18PxcNpThreadContextEPhffRKNS_6shdfnd3aos5Vec4VES9_S9_S9_:22282:3 (313ms), __Z7yyparsev:24516:21 (377ms), _TT_RunIns:30045:38 (631ms), __Z41Vectrosity_Vectrosity_VectorChar_get_dataP22mscorlib_System_Object:1299:13 (890ms)) AoL-Optimized.js
"run() called, but dependencies remain, so not running" index.html:63

"pre-main prep time: 580 ms" index.html:63

"missing function: _Z46Register_UnityEngine_WebCamTexture_get_devicesv" index.html:63

-1 index.html:59
-1 index.html:63

"Invoking error handler due to
uncaught exception: abort() at jsStackTrace@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:862:6
stackTrace@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:876:2
abort@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3407508:2
__Z46Register_UnityEngine_WebCamTexture_get_devicesv [Register_UnityEngine_WebCamTexture_get_devices()]@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:10873:2
__Z32RegisterAllStrippedInternalCallsv [RegisterAllStrippedInternalCalls()]@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:136605:2
__Z24RegisterAllInternalCallsv [RegisterAllInternalCalls()]@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3388528:2
_InitializeScriptingBackend@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3368460:2
_main@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:782906:2
asm._main@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3405477:2
callMain@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3407424:7
doRun@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3407460:4
run/<@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3407470:4
" UnityConfig.js:74
"Invalid function pointer called with signature 'viii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)" index.html:63

"Build with ASSERTIONS=2 for more info." index.html:63

129 index.html:59
129 index.html:63

uncaught exception: abort() at jsStackTrace@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:862:6
stackTrace@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:876:2
abort@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3407508:2
nullFunc_viii@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:12861:2
b129@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3397174:2
__ZNK10FileSystem10ToAbsoluteEPKc [FileSystem::ToAbsolute(char*)]@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:2449768:2
__Z18IsDirectoryCreatedRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE [IsDirectoryCreated?S(undefined?N?&)]@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:2603693:2
__ZN14CachingManager5ResetEv [CachingManager::Reset()]@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:2142901:8
__Z23FileSystemMountCallbackPv [FileSystemMountCallback(void*)]@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3186017:2
dynCall_vi@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3396047:2
Runtime.dynCall@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:189:4
_JS_FileSystem_Mount/<@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:11660:51
done@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:3232:5
IDBFS.reconcile@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:2484:4
IDBFS.syncfs/</<@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:2284:5
@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/AoL-Optimized.js:2368:7
UnityErrorHandler@file:///D:/Users/Alex/Desktop/AoL-Optimized/Data/UnityConfig.js:104:5

"warning: a problem occurred in builtin C++ name demangling; build with  -s DEMANGLE_SUPPORT=1  to link in libcxxabi demangling" index.html:63

which of course, doesn’t make a lot of sense to me. Can someone help?

I’m using Windows TP 10, Unity 5.0beta.

Hello Alexandru,

the error you are getting is due to the fact the Webcam textures are not supported on WebGL at the moment. In general, unsupported features should trigger a compilation error, but in this case it does not happen due to a bug that has already been fixed and will come in one of the future betas. Please get rid of the Webcam-related functionalities and build again. In case there were additional issues, it would be great if you could report a bug with the repro project included, so we could give it a look and fix your issues.

Talking about the export size instead, Ralph explained pretty well which files you should check to understand how much data is actually going to be sent to the client once your build will be uploaded online: WebGL build size for empty scene is huge. Optimisation tips and tricks? - Unity Engine - Unity Discussions
Give it a look, and let me know if you have any other question!

1 Like

Thanks for the reply Gabriele, i’ve just got to try removing the Webcam related problem. I do encounter another dought…

When i run the app, i get i pop-up saying :

and when i check the console, i see

any ideas?

I cannot run my little mobile game using WebGL either, you can try here [ http://www.bitgremlin.com/ew/index.html ] - view console to see stack traces. It looks like some AS libraries are not behaving nicely :).

@Lypheus , we’d really like to have a look at your project; can you file a bug with the project ? (also, to get a better idea yourself, you can enable C# exception handling in the webgl build in the playersettings).

This should work. @alexandru.badescu Can you submit a bug with this project? We can have a look at why this fails. Thanks.

How do I submit Unity 5.0 bugs?

From the Editor menu, choose the Help > Report a Bug option.

I submitted mine last night, look for “Re: RalphH” in the description though i’m sure it’ll be obvious enough :). Keep up the good work folks, 5 is looking awesome!

Thanks, your bug is 645439. We will have a look at it.

Hi Josh, unfortunately i’m not authorised to send the project… it’s company policy. Hoped it was a known issue :frowning:

Looking at your console output, I see it failing in:

__Z24CreateDirectoryRecursive"[…] index.html:63

File system access is not possible in WebGL in it’s current state (we will probably have something to work on a IndexedDB-backed local per app persistent store for a FS eventually at some point).

Press the […] button in the log in Firefox to see where this is coming from.

Thanks Josh.

I get this similar error popping up when I try and run the Nightmares project in WebGL.

An error occured running the Unity content on this page. See your browser’s JavaScript console for more info. The error was:
Uncaught abort() at Error
at jsStackTrace (http://192.168.1.81:8888/v2/Data/v2.js:862:12)
at stackTrace (http://192.168.1.81:8888/v2/Data/v2.js:876:21)
at abort (http://192.168.1.81:8888/v2/Data/v2.js:2481579:24)
at nullFunc_vi (http://192.168.1.81:8888/v2/Data/v2.js:12725:2)
at Array.b126 (http://192.168.1.81:8888/v2/Data/v2.js:2477053:2)
at Array.__ZN18VirtActionInvoker06InvokeEP10MethodInfoPv [VirtActionInvoker0::Invoke(void**)] (http://192.168.1.81:8888/v2/Data/v2.js:2401471:70)
at Object.dynCall_vii (http://192.168.1.81:8888/v2/Data/v2.js:2469671:31)
at invoke_vii (http://192.168.1.81:8888/v2/Data/v2.js:13585:24)
at Array.__Z57UnityEngine_UI_UnityEngine_UI_SetPropertyUtility_SetColorP22mscorlib_System_ObjectP29UnityEngine_UnityEngine_ColorS1_P42UnityEngine_UnityEngine_Events_UnityAction [UnityEngine_UI_UnityEngine_UI_SetPropertyUtility_SetColor?1(UnityEngine_UnityEngine_Color?S?**)] (http://192.168.1.81:8888/v2/Data/v2.js:1940591:2)
at Object.dynCall_viiii (http://192.168.1.81:8888/v2/Data/v2.js:2457993:33)

And when I look at the javascript console I get a whole load of errors.

(index):63 run() called, but dependencies remain, so not running
(index):63 pre-main prep time: 2088 ms
(index):59 PlayerConnection initialized from (debug = 0)
(index):59 PlayerConnection disabled - listening mode not supported
(index):59 Initialize engine version: 5.0.0b9 (597d678ee8c6)
(index):59 Renderer: WebKit WebGL
(index):59 Vendor: WebKit
(index):59 Version: WebGL 1.0 (OpenGL ES 2.0 Chromium)
(index):59 ANGLE_instanced_arrays GL_ANGLE_instanced_arrays EXT_blend_minmax GL_EXT_blend_minmax EXT_frag_depth GL_EXT_frag_depth EXT_shader_texture_lod GL_EXT_shader_texture_lod EXT_texture_filter_anisotropic GL_EXT_texture_filter_anisotropic WEBKIT_EXT_texture_filter_anisotropic GL_WEBKIT_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_compressed_texture_s3tc GL_WEBGL_compressed_texture_s3tc WEBKIT_WEBGL_compressed_texture_s3tc GL_WEBKIT_WEBGL_compressed_texture_s3tc WEBGL_debug_renderer_info GL_WEBGL_debug_renderer_info WEBGL_debug_shaders GL_WEBGL_debug_shaders WEBGL_depth_texture GL_WEBGL_depth_texture WEBKIT_WEBGL_depth_texture GL_WEBKIT_WEBGL_depth_texture WEBGL_draw_buffe
(index):59 rs GL_WEBGL_draw_buffers WEBGL_lose_context GL_WEBGL_lose_context WEBKIT_WEBGL_lose_context GL_WEBKIT_WEBGL_lose_context
(index):59 Creating OpenGLES2.0 graphics device
v2.js:10362 Unable to find type [UnityEngine.dll]UnityEngine.AssemblyIsEditorAssembly

v2.js:10362 The file ‘mainData’ is corrupted! Remove it and launch unity again!
[Position out of bounds!]

(index):59 Shader ‘Custom/Rim Lit Bumped Specular’: fallback shader ‘Specular’ not found
(index):59 WARNING: Shader Unsupported: ‘Custom/Rim Lit Bumped Specular’ - Pass ‘DEFERRED’ shader state not supported
(index):59 Shader ‘Legacy Shaders/Bumped Specular’: fallback shader ‘Legacy Shaders/Specular’ not found
2(index):59 WARNING: Shader Unsupported: ‘Legacy Shaders/Bumped Specular’ - Pass ‘DEFERRED’ shader state not supported
(index):59 WARNING: Shader Unsupported: ‘Legacy Shaders/Self-Illumin/Diffuse’ - Pass ‘DEFERRED’ shader state not supported
(index):59 WARNING: Shader Unsupported: ‘Legacy Shaders/Self-Illumin/Specular’ - Pass ‘DEFERRED’ shader state not supported
(index):59 WARNING: Shader Unsupported: ‘Legacy Shaders/Specular’ - Pass ‘DEFERRED’ shader state not supported
(index):63 exit(0) called, but noExitRuntime, so not exiting
v2.js:10369 test

v2.js:10369 move0 0

(index):63 Invalid function pointer called with signature ‘vi’. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)(index):63 Module.printErrv2.js:12723 nullFunc_viv2.js:2477053 b126v2.js:2401471 __ZN18VirtActionInvoker06InvokeEP10MethodInfoPvv2.js:2469671 dynCall_viiv2.js:13585 invoke_viiv2.js:1940591 __Z57UnityEngine_UI_UnityEngine_UI_SetPropertyUtility_SetColorP22mscorlib_System_ObjectP29UnityEngine_UnityEngine_ColorS1_P42UnityEngine_UnityEngine_Events_UnityActionv2.js:2457993 dynCall_viiiiv2.js:13537 invoke_viiiiv2.js:2194621 __Z47UnityEngine_UI_UnityEngine_UI_Graphic_set_colorP37UnityEngine_UI_UnityEngine_UI_Graphic29UnityEngine_UnityEngine_Colorv2.js:2469671 dynCall_viiv2.js:13585 invoke_viiv2.js:1562878 __Z35Assembly_CSharp_PlayerHealth_UpdateP28Assembly_CSharp_PlayerHealthv2.js:2457262 __ZN14ActionInvoker06InvokeEPFvPvES0_PS0_v2.js:2462623 dynCall_iiiiv2.js:14089 invoke_iiiiv2.js:2269761 __ZN6il2cpp2vm7Runtime6InvokeEP10MethodInfoPvPS4_PP12Il2CppObjectv2.js:2439745 _il2cpp_runtime_invokev2.js:2410495 __Z23scripting_method_invoke21ScriptingMethodIl2CppP15ScriptingObjectR18ScriptingArgumentsPP18ScriptingExceptionv2.js:1641262 __ZN25ScriptingInvocationNoArgs6InvokeEPP18ScriptingExceptionv2.js:2425447 __ZN25ScriptingInvocationNoArgs6InvokeEvv2.js:1620567 __ZN13MonoBehaviour16CallUpdateMethodEiv2.js:2463457 __ZN13MonoBehaviour6UpdateEvv2.js:2473635 dynCall_viv2.js:13937 invoke_viv2.js:1118347 __ZN20BaseBehaviourManager12CommonUpdateI16BehaviourManagerEEvvv2.js:2457245 __ZN16BehaviourManager6UpdateEvv2.js:2473635 dynCall_viv2.js:13937 invoke_viv2.js:114995 __Z10PlayerLoopbbP10IHookEventv2.js:2295695 __ZL8mainloopvv2.js:2476083 dynCall_vv2.js:193 Runtime.dynCallv2.js:10547 (anonymous function)v2.js:5586 Browser.mainLoop.runIterv2.js:10543 Browser_mainLoop_runner
(index):63 Build with ASSERTIONS=2 for more info.
(index):59 126
(index):63 126
(index):63 warning: a problem occurred in builtin C++ name demangling; build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling
UnityConfig.js:74 Invoking error handler due to
Uncaught abort() at Error
at jsStackTrace (http://192.168.1.81:8888/v2/Data/v2.js:862:12)
at stackTrace (http://192.168.1.81:8888/v2/Data/v2.js:876:21)
at abort (http://192.168.1.81:8888/v2/Data/v2.js:2481579:24)
at nullFunc_vi (http://192.168.1.81:8888/v2/Data/v2.js:12725:2)
at Array.b126 (http://192.168.1.81:8888/v2/Data/v2.js:2477053:2)
at Array.__ZN18VirtActionInvoker06InvokeEP10MethodInfoPv [VirtActionInvoker0::Invoke(void**)] (http://192.168.1.81:8888/v2/Data/v2.js:2401471:70)
at Object.dynCall_vii (http://192.168.1.81:8888/v2/Data/v2.js:2469671:31)
at invoke_vii (http://192.168.1.81:8888/v2/Data/v2.js:13585:24)
at Array.__Z57UnityEngine_UI_UnityEngine_UI_SetPropertyUtility_SetColorP22mscorlib_System_ObjectP29UnityEngine_UnityEngine_ColorS1_P42UnityEngine_UnityEngine_Events_UnityAction [UnityEngine_UI_UnityEngine_UI_SetPropertyUtility_SetColor?1(UnityEngine_UnityEngine_Color?S?)] (http://192.168.1.81:8888/v2/Data/v2.js:1940591:2)
at Object.dynCall_viiii (http://192.168.1.81:8888/v2/Data/v2.js:2457993:33)
v2.js:5592 Uncaught abort() at Error
at jsStackTrace (http://192.168.1.81:8888/v2/Data/v2.js:862:12)
at stackTrace (http://192.168.1.81:8888/v2/Data/v2.js:876:21)
at abort (http://192.168.1.81:8888/v2/Data/v2.js:2481579:24)
at nullFunc_vi (http://192.168.1.81:8888/v2/Data/v2.js:12725:2)
at Array.b126 (http://192.168.1.81:8888/v2/Data/v2.js:2477053:2)
at Array.__ZN18VirtActionInvoker06InvokeEP10MethodInfoPv [VirtActionInvoker0::Invoke(void
)] (http://192.168.1.81:8888/v2/Data/v2.js:2401471:70)
at Object.dynCall_vii (http://192.168.1.81:8888/v2/Data/v2.js:2469671:31)
at invoke_vii (http://192.168.1.81:8888/v2/Data/v2.js:13585:24)
at Array.__Z57UnityEngine_UI_UnityEngine_UI_SetPropertyUtility_SetColorP22mscorlib_System_ObjectP29UnityEngine_UnityEngine_ColorS1_P42UnityEngine_UnityEngine_Events_UnityAction [UnityEngine_UI_UnityEngine_UI_SetPropertyUtility_SetColor?1(UnityEngine_UnityEngine_Color?S?**)] (http://192.168.1.81:8888/v2/Data/v2.js:1940591:2)
at Object.dynCall_viiii (http://192.168.1.81:8888/v2/Data/v2.js:2457993:33)

Any ideas on how to fix this to get the Nightmares project i made working?

@Lypheus If looks like the project for bug 645439 builds correctly with WebGL now. I’m using the 5.0b13 code. I expect 5.0 b13 to be available next week, can you give this project a try again then? Thanks.

@jsleek It is difficult to tell without seeing the code in the project. Is this a project that you can submit with a bug report? If so, please do that and let me know the bug number. Thanks.

@jsleek Actually, I apologize. I was not aware that this is our learn project. You don’t need to submit a bug then, as we have an existing one for this problem. We have an issue where the WebGL build is incorrectly stripping out some code that can be used via events in the new GUI. We’re hoping to have this corrected in an upcoming beta.

@JoshPeterson Is there a thread discussing the bug or is it only a submission?

While we are on the topic of the Nightmares learn project, I get this error message when I have a Canvas Group on my MenuCanvas / HUDCanvas game objects:

UnityEngine.UI.Selectable.OnCanvasGroupChanged () (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/guisystem/UI/Core/Selectable.cs:136)

Has this bug already been reported or do i need to report it?

We don’t have a thread on the stripping bug, as it was found internally.

We do already have a bug for the OnCanvasGroupChanged problem, it is number 630651. So you do not need to submit one.

Both of these bugs should be fixed for the 5.0 release, but I’m not sure when they will be corrected beyond that.

Well, for me it exports the project.
But the visuals i’m getting are rather meh.
I set up a sample scene to start getting a feel for the new GI system and stuff.

This is what it would look like:


So i understand WebGL does not do image effects yet so it would be this:

But what i am getting is… this (firefox & chrome):

Using standard shader & reflection probes.
Problem on my side or known issue with WebGL?

WebGL should actuallyhandle image effects correctly, so you should be able to get the first image. Other then that, we have a bunch of graphics fixes lined up for WebGL already, to go into a beta soon, which might be relevant here. If you have a simple repro, it is best to submit a bug report, then i can check.