Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question WebGL - game not loading

Discussion in 'Web' started by Sahu, Nov 5, 2020.

  1. Sahu

    Sahu

    Joined:
    May 11, 2015
    Posts:
    3
    Hi,

    we are seeing some game not loading concerns in webgl release build, after analysing logs we found most of the game not loading concerns have these common footprints -

    Code (JavaScript):
    1. ModuleError: CompileError: WebAssembly.instantiate(): size 11062270 > maximum function size 7654321 @+11636326
    .

    Code (JavaScript):
    1. ModuleError: failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): Compiling function #3492 failed: Invalid opcode 0x12 (enable with --experimental-wasm-return_call) @+2200111
    .

    Code (JavaScript):
    1. ModuleError: failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): Compiling function #65975 failed: improper branch in br_table target 0 (depth 90) @+2244238
    2.  
    These happens during initial loading after which unity loader does not progress and it gets stuck.
    game was published with Unity 2019.2.12f1 and WebAssembly streaming is enabled with Gzip compression.
     
    Last edited: Nov 5, 2020
  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    951
    How large is the project? Does the issue reproduce when stripping down the code in the project? Does the issue reproduce on an empty project?
     
  3. Sahu

    Sahu

    Joined:
    May 11, 2015
    Posts:
    3
    code is pretty big- generated .data.unityweb & .wasm files are ~11 mb( release build). unfortunately we are not able to reproduce but found it via logs, happens 1 in 1000 cases. mostly seen with 32 bit OS/Browsers.
     
  4. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    951
    So the same code builds and runs most of the time on most browsers? But such errors occassionally pop up?

    It is clear in each error that the WebAssembly module has been miscompiled. Either the host browser must have been buggy, or maybe somehow the .wasm file got corrupted during the download. Are there any correlations to a specific browser version or OS (navigator.userAgent?) where those errors would be coming from?
     
    Sahu likes this.
  5. Sahu

    Sahu

    Joined:
    May 11, 2015
    Posts:
    3
    Thank you @jukka_j ,
    we did some primary investigation, and from logs it looks like most of the issues are low end system having 32 bit OS and browsers, would like to hear if there is any such known issue which unity dev team is aware of ? would you advise to have only webgl 1.0 build( currently it is 2.0 with 1.0 as fallback? any pointer if you would suggest which we can inject in UnityLoader.js file which reveals more info?
     
  6. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    951
    Issues with 32-bit browsers suggest problems with running out of memory address space.

    Try logging navigator.userAgent to paint a picture of which browsers and hardware systems the issue occurs. Maybe it happens in a specific browser, or a browser version.

    Making a WebGL 1 build instead of WebGL 2 will be very unlikely to affect this, since Wasm compilation occurs before WebGL API/context gets initialized - the code will not reach as far to do GL operation.