WebGL prevent Unresponsive script warning

To my understanding the unresponsive script warning in browsers pops up after a few million instructions have been run in 1 javascript without reaching some sort of conclusion to the code.

Seeing how Unity does not trigger this warning on it’s own (being a game loop and all). I assume that it somehow reports back to the browser that a timeframe can elapse. I imagine this works kind of like a coroutine, where the browser is the unityEngine, and the unity game is the coroutine doing a yield return null; every frame or so.

Currently i am using a 3rd party tool which does not allow me to fiddle with it. It does a load of math in 1 frame (for some reason no coroutine is in that tool) and it does this at the start of the level during loading. All this is covered by a loading screen for other builds, but WebGL starts complaining about unresponsive script due to the massive loop it gets dumped in for a few seconds.

Now my question: Is there a way to make unity do his callback to the javascript to let it know everything is still ok and running?
If not, would there be a way to implement this, or could this become a feature request?

I imagine it to work a bit the same like the way one can update a form in a windows form application when you have a horribly long loop in there. I forgot how it was named however.

Any advice, help or insight is greatly appreciated.
Thanks in advance,
Smileynator

i have the same problem and would like to see a solution to this, it’s a terrible experience for my user to see “Script unresponsive” when the game is just loading. My game is about 30MB Gzipped

I fixed this by making sure that the very top scene in my build list (the one that’s auto-loaded at game start) is as slim as possible. I made a empty scene with a single script that loads the next, asset-heavy, scene and this pop-up message disappeared.