What Player Loop sub-systems are required for execution of Tasks?

I’m currently setting a custom player loop where I need to make sure tasks (not using frame dependent awaits) run as expected.

As of now making sure UnityEngine.PlayerLoop.Update.ScriptRunDelayedTasks subsystem type is added to the current player loop works but I have cases where I may have UnityWebRequest written within the Task.

I can add UnityEngine.PlayerLoop.EarlyUpdate.UnityWebRequestUpdate but are there any other subsystems that need to be considered to be added to custom player loop or any detailed documentation on the subsystems will be of great help!

You mean System.Task? In WebGL? You are aware that some Task methods will freeze, like Task.Delay() because they rely on threading internally.

And what exactly does “run as expected” mean?


The custom player loop seems to be under or non-documented specifically because of its power to make things go wrong, badly. I once thought it would be great to build up my own custom update loop this way, but it really isn’t. I broke so many things in that process, I just used a simple root script whose Update calls out to other classes in a fixed order. If that’s good enough for you, go for it.

I meant, once I add the player loop subsystems in my custom player loop, await calls should continue execution.

That seems to infer you are looking for background execution? If so, that will not work on the web. It is single-threaded for the time being.

For other platforms, it may work but only if the background code does not access the Unity API, with the exception of some standard types like Vector3.

Yes!
Anyways, I was successful running it in bg. So far don’t see any problems.

Thanks @CodeSmile. I started following your devlog :slight_smile: