NVentimiglia / Unity3d-Foundation

Unity3d Databinding, MVVM, Tasks, Localization

Home Page:http://www.nicholasventimiglia.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebGL player

spacecatx opened this issue · comments

Hi, we are using Task in Unity to run a lot of async tasks and want to port to WebGL.
There is obviously an issue with threads not being supported in WebGL
We don't absolutely need to do these tasks on the background, can forcing single thread allow the library to run without having to refactor our code?
If we are OK with Async on the main thread can we just switch all of our Task.Run commands to Task.RunCoroutine?

Use Task.RunCoroutine. You can not run background threads in WebGL.

Frankly, I do not use Task.Run unless I know I need to do some heavy calculations off the main thread or dealing with sockets (And I know the platform can support it). Most of the time I end up using Task.RunCoroutine (or a result callback) as I anticipate supporying WebGL.