Audio muting doesn't work in WebGL build

Hi, I’m creating a browser game and I have a problem with sound. While the game is displaying video ad, the game audio should be muted, I created a separate function for this, which works in the editor, but does not work at all in the finished WebGL build, anyone have an idea why?

public void OnAdRequested()
{
        mainMixer.SetFloat("masterVolume", -80f);

        Debug.Log("OnAdRequested()");
}

public void OnAdCompleted()
{
        if (playMusic || playSound) mainMixer.SetFloat("masterVolume", 0f);

        Debug.Log("OnAdCompleted()");
}

Interestingly, the code is invoked correctly, as I checked in the browser console. All references are set correctly, I really have no idea what could be wrong anymore.

Unity Version: 2022.3.12f1


9463268--1329467--upload_2023-11-10_16-9-58.png

1 Like

I am sincerely sorry to say that the AudioMixer and OnAudioFilterRead are audio features that are not available specifically on WebGL. Here’s a page listing the what’s available for audio in that context: