x


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?

more ▼

asked Mar 14 '11 at 07:05 AM

Takezou gravatar image

Takezou
3 2 2 3

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first
   AudioListener.pause = true;



  AudioListener.volume = 0;

try this

http://unity3d.com/support/documentation/ScriptReference/AudioListener-pause.html

more ▼

answered Mar 14 '11 at 07:26 AM

robertmathew gravatar image

robertmathew
571 35 39 51

Thanks for the info it :)

Mar 14 '11 at 09:14 AM Takezou
(comments are locked)
10|3000 characters needed characters left

for JS

//Sound Mute button
if(GUI.Button(Rect(55, 200, 180, 40), "Audio Mute")) {

    AudioListener.volume = 1 - AudioListener.volume;

}
more ▼

answered Sep 18 '12 at 04:02 PM

SeveneduS gravatar image

SeveneduS
21 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1027
x523
x18

asked: Mar 14 '11 at 07:05 AM

Seen: 5073 times

Last Updated: Sep 18 '12 at 04:02 PM