Search Issue Tracker
Fixed in 2020.2.X
Fixed in 2019.4.X, 2020.1.X
[WebGL] Async Tasks do not run on WebGL when Threading is enabled
1. Open the attached project ("case_1243010-WebG-Threads.zip")
2. Open the repro scene ("SampleScene")
3. Enter Play Mode
4. Notice the logs about async tasks being printed out to the screen
5. Exit Play Mode and make a WebGL build
6. Run the build and inspect the printed messages on the screen
Expected result: Async task messages are printed to the screen
Actual result: Only 'Start' and 'End' messages are printed to the screen (async tasks doesn't run)
Reproducible with: 2019.3.14f1, 2020.1.0b9, 2020.2.0a11
Couldn't test with 2018.4 (errors when building the project)
Tested with: Chrome (81.0.4044.138)
Jul 29, 2022 09:00
Still not fixed in 2019.4.26f1
Just found this out after replacing all my coroutines with async/await :D
Jul 07, 2022 19:07
Task.Delay() is implemented for WebGL, but it uses a System.Timer, which requires threading support, and because of that is not compatible.
code source: https://github.com/Unity-Technologies/mono/blob/unity-mono-4.8.0-branch/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs#L5909
Replace Task.Delay() with Task.Yield() and the code will work on WebGL.
Jan 23, 2022 03:43
I've tried this in 2020.3.26f1, 2019.4.34.f1 (LTS) and 2019.4.7f1
and none of those have worked. (first 2 being the latest (LTS) builds)
Jan 20, 2022 14:16
Can confirm, still not working in 2021.2.7f1
Feb 22, 2021 19:33
Why is this closed, doesn't work in 2019.4.8f1 either.
Jan 13, 2021 12:31
Just tested in 2019.4.7f1, it does not work.
Simple thing like this does not work:
Test.text = "1";
Test.text += "2";
Test.text += "3";
Unity only pretends it's multi-platform, it's actually multi-pain.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Long Prefab save times when using Unity 2022.2 and higher
- Console displays error "UnityException: Creating asset at path Assets/Scenes/ .scenetemplate failed." during scene template saving
- "Development Build" watermark is shown in non-development UWP release builds
- Console errors appear when the Inspector is set to Debug and a GameObject is selected
- A script public variable value is not used when set in the Inspector window
Resolution Note (fix version 2020.2):
IL2CPP wasn't generating the correct threaded code when threadingSupport flag was set in the project settings. Fixed in 2020.2.0a16
Resolution Note (fix version 2020.1):
Fixed in 2020.1.0b17.4177
Resolution Note (fix version 2019.4):
Fixed in - 2019.4.7f1