Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question State of supporting Multithreading for WebGL builds?

Discussion in 'Web' started by nfynt-zap, Feb 6, 2023.

  1. nfynt-zap

    nfynt-zap

    Joined:
    Jun 3, 2021
    Posts:
    20
    I am familiar that this age old topic has been supported as an experimental feature since 2019 LTS. And it's quite hit and miss to even build your project with its support on Unity version 2021.x LTS or before, I got build errors with 2019.4.27f1 & 2021.3.2f1.

    Anyways now that I am on 2022.2.4f1, the build issues along with few emscripten and JS related fixes seems to have been put in place. So, now I can build the wasm test project and host via a modified http.server python server providing the necessary COOP and COEP, CORS. But, now stuck at runtime exceptions in worker.js, regarding which I don't have much clue at the moment. Thought would check to see if anyone else is using this feature or got any ideas here.

    Please find few screenshots in the attachment and WebGL build linked as zip here. In brief, I've got following errors:
    Code (JavaScript):
    1. mt.worker.js:65 RuntimeError: null function or function signature mismatch
    2.     at AGCThread::Run() (mt.wasm:0x2ddf9b3)
    3.     at AGCThread::RunThread(void*) (mt.wasm:0x2ddf79a)
    4.     at Thread::RunThreadWrapper(void*) (mt.wasm:0x2ee8dc0)
    5.     at dynCall_ii (mt.wasm:0x2f23430)
    6.     at mt.framework.js:1686:20
    7.     at mt.framework.js:2205:21
    8.     at Object.invokeEntryPoint (mt.framework.js:2206:3)
    9.     at self.onmessage (mt.worker.js:144:48)
    Code (JavaScript):
    1. Pthread 0x01b850f8 sent an error! http://localhost:8000/Build/mt.worker.js:197: Uncaught RuntimeError: null function or function signature mismatch
    2. printErr @ mt.loader.js:82
    3. worker.onerror @ mt.framework.js:2143
    Some project settings related changes are:
    PlayerSettings.WebGL.emscriptenArgs = "-s ALLOW_MEMORY_GROWTH=1 -s PTHREAD_POOL_SIZE=8 -s PTHREAD_POOL_SIZE_STRICT=0";
    PlayerSettings.WebGL.threadsSupport = true;


    Thanks.
     

    Attached Files:

  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,299
  3. pravusjif

    pravusjif

    Joined:
    Jul 24, 2012
    Posts:
    18
    Hello there, I'm having that exact same issue with the `null function or function signature mismatch` error in `worker.js` @nfynt-zap have you been able to identify what's causing it?
     
  4. nfynt-zap

    nfynt-zap

    Joined:
    Jun 3, 2021
    Posts:
    20
    Yes, it was due to a missing translation for `SceneManager.LoadScene` on the JS side, as mentioned in forum thread here.

    And here's the bug report stating it to be fixed in 2022.3.6f1, https://issuetracker.unity3d.com/is...match-error-when-building-a-project-for-webgl
    Haven't tested the fix, but do post here if it works.