- Home /
The question is answered, right answer was accepted
Sound in unity3d
I have a homepage with menu. Sound is one among them. While touch it sound, should get disable. In next touch sound should get enable. How can i on and off sound from menu while touching sound button?
Thanks in Advance
Answer by sona.viswam · Jan 18, 2013 at 04:58 AM
if(AudioListener.pause == true){
AudioListener.pause = false;
}
else{
AudioListener.pause = true;
}
Answer by DarkSyntaxz · Dec 28, 2012 at 11:48 AM
I'm having a guess here, but you could possibly add the sound scripts to an empty game object called "sound", and in the script where the sound button is located you could add a toggle function that where:
if sound is enabled and we press sound button , soundEnabled = false
and
if sound isn't enabled and we press sound button , soundEnabled = true;
Take a look at the GUI.Toggle docs
Follow this Question
Related Questions
How to Make my Character Run? 1 Answer
How to implement a low pass filter for accelerometer? 2 Answers
Input.acceleration to camera 0 Answers
UNITY3D: TEXTFILE I/O : Don't write same things 0 Answers
What is wrong with this script? 2 Answers