Stuttering during scene load in webgl


I recently added fmod to my Unity game. In webgl builds, whenever the scene loads, the music starts stuttering. I realize this could be because html5 is single threaded, but using Unity’s standard audio you can have music playing during scene transitions, so I’m hoping this is just something I’m doing wrong.

Any suggestions would be appreciated. In my game you die a lot, and every time you do the scene is reloaded, so it would be quite annoying to have the music either stutter or be interrupted every time.


Yes, FMOD in webgl is single threaded, so is 100% dependent on System::update being called regularly. If there are delays between System::update calls, there will be discontinuity.

Loading data might be a reason for a big stall like this. Unity might be splitting its own internal audio update between loading data in small chunks. We don’t have that level of control. As the user you can stop audio or try to make the update run during loading somehow.

Thanks @brett for your response. I will try loading scenes asynchronously, which may solve the issue.

But honestly it seems like this is an issue that’s solvable by FMOD. It could create an iframe (or similar, like a seperate wasm environment) that does all the processing.

I’m pretty sure that if I had two Unity webgl builds running on the same page, scene loading in one wouldn’t halt music in the second. So if that’s the case, it’s technically possible for FMOD to handle this in the background, especially since it loads the banks from streamingassets.

Whether that is worth it or not is not up to me of course, but it seems to me that the industry standard for game audio should be able to play music without interruption. And if my proposed solution has side effects that I’m not thinking of, it could be made optional.

FMOD is an emscripted converted library, we’re not going to start spawning unexpected iframes in a browser.
Unity audio is nothing but a wrapper for webaudio, it is very limited. FMOD is a realtime mixing engine with much more flexibility, and many many more features.

HTML5 is very limited. It does not support pthreads properly, the browser support for this has been lagging for years. When that happen you can stop needing to update fmod’s mixer from the update.

This is why other engines don’t attempt to even support HTML5, FMOD gets by in the best way it can with the available technology.