|
I have this code and would like to add an audio on/off and pause to it but i keep getting errors, please advice. private var toggleState1 : boolean = false; private var toggleState2 : boolean = false; function OnGUI() { }
(comments are locked)
|
|
Use AudioListener.pause to pause all sounds in your game - audio.mute only mutes the AudioSource of the script owner object.
@script ExecuteInEditMode()
private var toggleState1 : boolean = false;
private var toggleState2 : boolean = false;
function OnGUI() {
toggleState1 = GUI.Toggle(Rect((Screen.width - 800)/2, 20, 150, 20), toggleState1, "Sound on/off");
AudioListener.pause = toggleState1;
toggleState2 = GUI.Toggle(Rect((Screen.width - 800)/2, 40, 150, 20), toggleState2, "Pause");
Time.timeScale = toggleState2? 0 : 1;
}
It works now thanks (:
Jan 16 '12 at 02:41 AM
malcolmtwl
(comments are locked)
|
|
this is my pause button code and you can use audio.mute = true/false to toggle music ok will try it out
Jan 16 '12 at 01:46 AM
malcolmtwl
(comments are locked)
|
