- Home /
how do i mute all audio sound?
var muted = false; function OnMouseDown(){
if(muted == false){ audio.volume = 0; muted = true;
} else if (muted == true){ audio.volume = audio.maxVolume; muted = false;
}
}
i Added the script above to an object "music" on my main menu but it jus mute the audio that is attach to it. how do i mute the rest of the audio which is attach to other objects?
Answer by robertmathew · Mar 14, 2011 at 07:26 AM
AudioListener.pause = true;
AudioListener.volume = 0;
try this
http://unity3d.com/support/documentation/ScriptReference/AudioListener-pause.html
Answer by SeveneduS · Sep 18, 2012 at 04:02 PM
for JS
//Sound Mute button
if(GUI.Button(Rect(55, 200, 180, 40), "Audio Mute")) {
AudioListener.volume = 1 - AudioListener.volume;
}
This will only work if the current volume is exactly 0 or 1
Your answer
Follow this Question
Related Questions
mute/un-mute 1 Answer
Mute/Unmute not working with new sounds 2 Answers
mute / unmute helps 2 Answers
Need help making an audio trigger. 2 Answers
Audio files not playing at all 4 Answers