Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved Issue with Muting SFX Audio Group in Unity Audio Mixer

Discussion in 'Audio & Video' started by HexDog, Apr 3, 2024.

  1. HexDog

    HexDog

    Joined:
    Mar 31, 2019
    Posts:
    57
    Dear Community Members,

    I am currently encountering a perplexing issue within Unity regarding the muting of the SFX (sound effects) audio group within the audio mixer. Despite setting its value to -80dB, the audio persists even in a muted state. Notably, while every Audio Source shares the same SFX group output, only a select few are affected by this behavior post-game build for the Android platform. Strangely, within the Unity editor, the functionality behaves as expected.

    Furthermore, upon debugging the group volume, the correct dB value is obtained. However, when debugging the output group of the Audio Source, it consistently shows a value of -0.087dB instead of the intended -80dB, despite both referring to the same group. Importantly, no alterations are made between these two debug points, yet the outcomes differ significantly.

    Below is the code snippet utilized for volume adjustment:

    Code (CSharp):
    1. public void SetVolume(string group, float db)
    2. {
    3.    db = Mathf.Clamp(db, -80, 20);
    4.    mixer.SetFloat(group, db);
    5. }
    Additionally, the volume adjustment function is invoked as follows:

    Code (CSharp):
    1. audio.SetVolume("SFXVolume", status ? 0 : -80);
    I am currently working with Unity version 2021.3.28f1.

    I would greatly appreciate any insights or suggestions regarding this issue.

    Thank you in advance.

    Additional: I'm using a singleton class which load the mixer before the scene is initialized.

    UPDATE: The problem caused by Addressables.
     
    Last edited: Apr 4, 2024