Quantcast
Channel: Questions in topic: "loops"
Viewing all articles
Browse latest Browse all 184

How do I stop sound from looping on button press again

$
0
0
I have a simple button script for a two state button, but I'm having trouble trying to figure out how to make the sound stop looping when I press the button again. Here is what my script looks like. //var levelToLoad : String; var mouseUpTexture : Texture2D; var mouseDownTexture : Texture2D; var beep : AudioClip; var SurveillanceSoundFX : AudioClip; function OnMouseDown(){ guiTexture.texture = mouseDownTexture; audio.PlayOneShot(beep); audio.loop = true; audio.clip = SurveillanceSoundFX; audio.Play(); } function OnMouseUp(){ guiTexture.texture = mouseUpTexture; yield new WaitForSeconds(0.3); //Do Something }

Viewing all articles
Browse latest Browse all 184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>