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. Dismiss Notice

Your browser does not support WebAssembly Threads.

Discussion in 'WebGL' started by perplex_bcn, Jul 25, 2019.

  1. perplex_bcn

    perplex_bcn

    Joined:
    Mar 1, 2013
    Posts:
    22
    Hi,

    I have a Unity project (2019.1.11f1)
    I've just generated the build for WebGL with no thread support
    Code (CSharp):
    1. PlayerSettings.WebGL.threadsSupport = false;
    However when trying load the build on Firefox, I see a dialog box showing the message: Your browser does not support WebAssembly Threads. So, the loading of the build is aborted.

    Digging into the UnityLoader.js file and inspecting the web page I realised that some conditional evaluations are wrong.
    At some point in the code you find:
    Code (CSharp):
    1. if(e.multithreading&&!UnityLoader.SystemInfo.hasWasmThreads)return void t("Your browser does not support WebAssembly Threads.");
    Inspecting the values in the web console we have the following:
    - !UnityLoader.SystemInfo.hasWasmThreads is boolean and evaluated as true
    - e.multithreading is a string and is evaluated as "false"
    - Finally, e.multithreading&&!UnityLoader.SystemInfo.hasWasmThreads is evaluated as true and the dialog box is shown.

    The way to avoid this behavior is replacing e.multithreading by e.multithreading=="true"

    Also found something similar earlier in the code:
    Code (JavaScript):
    1. n()?!UnityLoader.SystemInfo.hasThreads&&e.multithreading?r("Your browser does not support multithreading."):t()
    Just in case someone has the same problem. Will also report a bug.

    Regards.
     
    deus0, ronshalev3d and De-Panther like this.
  2. deus0

    deus0

    Joined:
    May 12, 2015
    Posts:
    256
    2020 this is still here? Was getting the error in fitefox. Will try this fix thank you :)
     
  3. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    755
    It seems the issue is somewhere deeper, at least in 2020.1.0 (the most recent version I know to allow me to build with "PlayerSettings.WebGL.threadsSupport=true").
    In <ProjectName>.loader.js, the "u.SystemInfo.hasThreads" seems to return false on all browsers, and even if I remove that check manually, I then get "Current environment does not support SharedArrayBuffer, pthreads are not available".
    All my browsers are at latest versions, and I even tried enabling "Experimental WebAssembly" or "WebAssembly baseline compiler" in chrome (via about://flags). No result.
     
  4. wewear

    wewear

    Joined:
    Oct 18, 2021
    Posts:
    3
    Anyone solved this? I tried on 2022.2 Beta and still the same problem
     
    havokentity likes this.
  5. tteneder

    tteneder

    Unity Technologies

    Joined:
    Feb 22, 2011
    Posts:
    162
    A requirement for SharedArrayBuffers an multithreading to work is that your HTTP server has correct COOP and COEP, CORS headers setup.

    For local development an easy way is opening up a terminal, navigating to your build's folder and run this:

    Code (csharp):
    1. npx statikk --port 8000 --coi
    Afterwards you can navigate to http://localhost:8000 in your browser.

    You have to install node first (comes with npx).

    hth
     
    OmarVector likes this.