I have set a volume slider which is connected to the master volume, but it does not reduce the volume even if the slider is reduced or increased(even though in the audio mixer it shows master volume being reduced when the slider is moved)
The code for slider is given below:
public class OptionsMenu : MonoBehaviour
public AudioMixer mixer;
public void SetLevel(float sliderValue)
mixer.SetFloat("MasterVolume", Mathf.Log10(sliderValue) * 20);
I have various scenes in the game, but I want this controller to reduce volume for all the scenes(it is the main volume controller in options menu). However it doesn’t even reduce volume for the MainMenu scene which contains the options Menu. What should I do to resolve this?
You could create a script that you attach to the varius different sounds you have, that contains them in different lists like “uiSounds” and so forth - and then have a method which checks the master-volume value and caps off at the same volume. Or alternatively lowers them by percentage as well.
Alternatively you could just reference all sounds to the master volume slider’s value and reference them that way.
But i think generally what your problem is, is that no other sound value is referencing or understanding or seeing the master volume’s value. So maybe start there?
select sounds game objects and make sure their output from the inspector is set to the MasterVolume.
Encountered this one too. It works fine in the editor, but it seems like some sounds in different mixer channels aren’t affected by master at all