I have a simple script that can set the sound on or off. Or i have two questions. This is the script:
var sound : boolean = false;
var music : AudioClip;
function OnGUI () {
GUI.Box (Rect (10,10,120,90), "Options");
if (GUI.Button (Rect (20,40,100,20), "Sound on/off")) {
if(sound) {
sound=false;
}
else {
sound = true;
}
}
}
First if the sound is true, then wil i that music begins play. I wil that he loop, so long i click not on the button. Or if the sound is false, then wil i that the music stops. Can anyone help me?
NOTE:i am a script noob.