Unity WEBGL FMOD 2.02.08 - Audio will not start without user interaction

Hi all,

When testing my latest WEBGL game on Itch.io I’ve discovered that audio will not play unless the user clicks within the game window first. Then the audio starts from the beginning and catches up to where it’s supposed to be.

While researching I did find a couple of posts mentioning a workaround that involves adding the following code to some sort of user interaction. Like a button click to start the game.

    FMODUnity.RuntimeManager.CoreSystem.mixerSuspend();
    FMODUnity.RuntimeManager.CoreSystem.mixerResume();

However, this does not seem like a sufficient workaround, especially because my previous games that also use FMOD work just fine

Some links for testing:

  • Audio does not start until you click in the window using FMOD 2.02.08 and Unity 2021.3.5f1: The Electrician Game

  • Audio starts correctly using FMOD 2.02.04 and Unity 2020.3.32f1: Film Morbid

Is there a definitive solution to this issue?

Thanks!

-Ken

edit: Tested in EDGE and CHROME browsers with same outcome.

Also, I’m using the same FMOD Bank Loader script in a loading scene in both games before audio begins

Update:

Tried implementing the following code on button press before loading banks and scenes. The game will no longer load on itch.io.

It gets stuck on the “Loading game for the first time” prompt that shows before the Unity window loads.

In fact, if this code exists anywhere in my project, it seems to break the build. Even if it’s commented out, which I don’t understand at all.

I’m going to update to the latest Unity LTS version to see if that helps.

My last 3 WEBGL games have worked great using FMOD however this latest project has inexplicably become a nightmare, if anyone has any suggestions it would be a great help

User interaction before playing audio is a requirement of modern web browsers, although I have reproduced the case of WebGL working fine without user interaction in 2.02.05 and below.
While technically 2.02.06 and above is the correct and intended behaviour, I can see how the previous behaviour would be more desirable, so I have passed this onto the Dev team to see how it was previously possible to bypass this requirement.
In the meantime, the recommened approach is to prompt a user interaction before you want audio to begin.

I have not been able to reproduce this issue- and I also do not understand how having it commented out could break your build, so I suspect there may be another issue. That said, there should be no need to call mixerSuspend / mixerResume yourself in 2.02.08.

I did eventually redesign my splash screen to require the user to click in the game canvas and it’s working fine now.

I tested it a few times and each time the results were the same. Though it makes no sense I thought it couldn’t hurt to mention it. You’re probably right that something else must be going on there.

Thanks for the response and the information!

-K