Search Unity

WebGL Build Loads But Get A JavaScript Error

Discussion in 'Web' started by Mitch_AWeekAgo, Jan 9, 2018.

  1. Mitch_AWeekAgo

    Mitch_AWeekAgo

    Joined:
    Oct 19, 2014
    Posts:
    22
    Hi,

    I need help to fix this bug, I've been struggling with it for a while now. I'm trying to upload a simple webgl build to itch.io for testing purposes. The error occurred right when the game finished loading. I get the same error when I try to run the game in a local folder with index.html. "An error occured running the Unity content on this page. See your browser JavaScript console for more info. The error was: ReferrenceError: xxxWebContainer is not defined. When I check the web debugger UnityLoader.js is the one throwing the error on line 1. The thing is xxxWebContainer is never mentioned in the UnityLoader.js. Does anyone know how to fix it? what is going on?

    I'm using unity 5.6.3p4. Thanks.

    Here is the error:
    exception thrown: ReferenceError: xxxWebContainer is not defined,_retrieveGameState@blob:null/b1a0d3c0-6e38-4392-b5b9-d9045f7af547:2:103052
    IZm@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:19:1
    X7n@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:22:1
    invoke_iiiii@blob:null/b1a0d3c0-6e38-4392-b5b9-d9045f7af547:2:334896
    OZm@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:19:1
    J0m@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:19:1
    HPl@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:5:1
    GEk@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:4:1
    BKm@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:19:1
    EZj@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:4:1
    u9n@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:22:1
    invoke_iiii@blob:null/b1a0d3c0-6e38-4392-b5b9-d9045f7af547:2:349947
    _nn@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:19:1
    Hsn@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:19:1
    J6@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:11:1
    H6@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:11:1
    F0a@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:16:1
    C0a@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:16:1
    y0a@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:16:1
    J0a@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:16:1
    G0a@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:16:1
    C0a@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:16:1
    y0a@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:16:1
    v0a@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:16:1
    QTb@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:18:1
    lxb@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:18:1
    MWa@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:16:1
    pja@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:15:1
    cja@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:15:1
    k8n@blob:null/ba99a0be-4d4b-45c0-8dfb-5e149030b93f:22:1
    browserIterationFunc@blob:null/b1a0d3c0-6e38-4392-b5b9-d9045f7af547:2:47933
    runIter@blob:null/b1a0d3c0-6e38-4392-b5b9-d9045f7af547:2:51025
    Browser_mainLoop_runner@blob:null/b1a0d3c0-6e38-4392-b5b9-d9045f7af547:2:49470
    UnityLoader.js:1:7402
    Invoking error handler due to
    ReferenceError: xxxWebContainer is not defined
    UnityLoader.js:1:13891
     
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Hi, does it work locally?
     
  3. Mitch_AWeekAgo

    Mitch_AWeekAgo

    Joined:
    Oct 19, 2014
    Posts:
    22
    Unfortunately, it doesn't run locally, I get the same error when I try to run it.
     
  4. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    I would suggest you to reproduce with a Development build, and look at the browser log for any error/warning.
     
  5. Mitch_AWeekAgo

    Mitch_AWeekAgo

    Joined:
    Oct 19, 2014
    Posts:
    22
    Similar result on a Development build. The progress bar gets full, but the game does not load so I can't see the log. The only differences is that it never shows the error message like before.
     
  6. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    could you post the development build stacktrace ?
    to see the log, right click on the page => Inspect => console
     
  7. Mitch_AWeekAgo

    Mitch_AWeekAgo

    Joined:
    Oct 19, 2014
    Posts:
    22
    Yeah the error that I wrote in the first post comes from the build page => Inspect => console. I checked the console in the development build and it shows the same error, however more details on the error at the bottom:

    ReferenceError: xxxWebContainer is not defined
    [Learn More]
    a3b44d3c-2b7e-4428-8d4e-74313b62ce8c:4212:2
    _retrieveGameState
    blob:null/a3b44d3c-2b7e-4428-8d4e-74313b62ce8c:4212:2
    _SaveManager_retrieveGameState_m4258886723
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1518314:1
    dynCall_iiiii
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1751703:1
    invoke_iiiii
    blob:null/a3b44d3c-2b7e-4428-8d4e-74313b62ce8c:15586:10
    _SaveManager_LoadSaveData_m4066660406
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:898856:1
    _WaitUntilLoaded_get_keepWaiting_m3833295052
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1274815:1
    _CustomYieldInstruction_MoveNext_m486982469
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1741034:1
    __ZN21InterfaceFuncInvoker0IbE6InvokeEjP11Il2CppClassP12Il2CppObject
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1233719:1
    _SetupCoroutine_InvokeMoveNext_m2975616245
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1267428:1
    __Z53RuntimeInvoker_Void_t1841601450_Il2CppObject_IntPtr_tPK10MethodInfoPvPS2_
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1556395:1
    dynCall_iiii
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1769443:1
    invoke_iiii
    blob:null/a3b44d3c-2b7e-4428-8d4e-74313b62ce8c:16218:10
    __ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1444547:1
    _il2cpp_runtime_invoke
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1661955:1
    __Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1533767:1
    __ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:987734:1
    __ZN9Coroutine14InvokeMoveNextEP21ScriptingExceptionPtr
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1157005:1
    __ZN9Coroutine3RunEPb
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1291669:1
    __ZN13MonoBehaviour24TryCreateAndRunCoroutineE18ScriptingObjectPtr18ScriptingMethodPtrPP9Coroutine
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:577176:1
    __ZN9Coroutine35HandleIEnumerableCurrentReturnValueE18ScriptingObjectPtr
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:381962:1
    __ZN9Coroutine23ProcessCoroutineCurrentEv
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1068642:1
    __ZN9Coroutine3RunEPb
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1291691:1
    __ZN13MonoBehaviour24TryCreateAndRunCoroutineE18ScriptingObjectPtr18ScriptingMethodPtrPP9Coroutine
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:577176:1
    __ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtr
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:974267:1
    __ZN13MonoBehaviour16DelayedStartCallEP6ObjectPv
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1228538:1
    __ZN18DelayedCallManager6UpdateEi
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:526828:1
    __ZZ23InitPlayerLoopCallbacksvEN45EarlyUpdateScriptRunDelayedStartupFramestruct7ForwardEv
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1717160:1
    __Z10PlayerLoopv
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:397439:1
    __ZL8MainLoopv
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1134001:1
    dynCall_v
    blob:null/c8b114c3-4a15-43c3-82d0-e63ca67c1481:1819719:1
    browserIterationFunc
    blob:null/a3b44d3c-2b7e-4428-8d4e-74313b62ce8c:2389:4
    runIter
    blob:null/a3b44d3c-2b7e-4428-8d4e-74313b62ce8c:2491:5
    Browser_mainLoop_runner
     
  8. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    seems strange that you don't see anything else in the log. Perhaps check the log filters or try another browser.

    Anyway, it seems to happen in your scripts. Do they call into a js plugin? Can you narrow it down on your side now that you have a re-enable stacktrace?
     
  9. Mitch_AWeekAgo

    Mitch_AWeekAgo

    Joined:
    Oct 19, 2014
    Posts:
    22
    Yeah, it was a call into a js plugin. Thanks for your help.
     
  10. kamleshkumarsahoo740

    kamleshkumarsahoo740

    Joined:
    Sep 18, 2021
    Posts:
    1

    Hey,. I'm just having the same kind of issue. When I build it in WebGL it's throwing a pop up message of errors after the Unity loader, I tried disabling compression and still not working. Can you tell me how you managed to get it done right.
    Its Unity 2020.
     
    trombonaut likes this.