- Home /
Mute audio in every scene problem
Hello everybody, I am new in Unity and I need your help. I wanted mute all sounds in every scene so I made Master AudioMixer and set this audiomixer as output for every audio source. I have got game with 3 scenes and I have mute and unmute button in first and last third scene. If I mute game in first scene in third scene it shows me unmute button instead mute button although music doesnt play. Here is my script in which doesnt work start method and image. Thanks for your reply I will appreciate it.
public GameObject muteButton;
public GameObject normalButton;
public AudioMixer masterMixer;
private float muteFloat = -80f;
private float normalFloat = 0f;
private void Start()
{
if (masterMixer.Equals(-80f))
{
muteButton.SetActive(true);
normalButton.SetActive(false);
}
else if (masterMixer.Equals(0))
{
muteButton.SetActive(false);
normalButton.SetActive(true);
}
}
public void SetMusicMute()
{
masterMixer.SetFloat("musicVolume",muteFloat);
}
public void SetMusciNormal()
{
masterMixer.SetFloat("musicVolume", normalFloat);
}
Where you say "If I mute game in first scene in third scene it shows me unmute button ins$$anonymous$$d mute button although music doesnt play.", isn't that what you want it to do? So you mute the sound in scene 1, and in scene 3 it is still muted and you have an unmute button available. What is actually the problem you're having?
Answer by Sottnik · Apr 02, 2017 at 09:57 AM
It was switched,but i have already fixed it. Anyway thank you very much. @Joe-Censored