how to stop a sound

I’ve google searched and read through the answers here - a lot say to use the audio.Stop(); - seems easy enough. But when I put it in my code, I get nothing. I have an audio listener on my camera, and an audio source on my game controller GameObject that is right near the camera. The audio clip is set to loop but not to play on Awake - I want the script to start and stop the sound… can anyone tell me what I’m doing wrong?

I just want the sound to play when the game starts, and STOP when the player clicks the Gui.Button “play_button”.

function Start () {

function OnGUI() { = MyGUISkin;
		if (GUI.Button(Rect(1600,640,175,175),"", "reload_button"))
			Application.LoadLevel ("PressYourLuck");

        if (GUI.Button(Rect(1350,640,175,175),"", "play_button"))
        	if(IsInvoking("CycleTextures") == true)
				InvokeRepeating("CycleTextures", 0, texDelay);
				InvokeRepeating("CycleIndicator",indDelay, indDelay);

as of now NOTHING is playing… im tearing out my hair here can anyone point me in the right direction without a “RTFM”, please?


Simply move your audio.Stop() to where it should be:

if (GUI.Button(Rect, "", "play_button")) {
    //Code in here gets executed for the frame that the button is pressed in
    audio.Stop(); //<- place here
else {
    //Code in here gets executed every frame except for the one where the button is pressed
    //Stopping audio here, stops it every frame
    //audio.Stop(); //<- hot here

Hope this helps,