Guest User

SoundBoard Playsound

a guest
Nov 9th, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. var model : GameObject;
  2. var track : AudioSource;
  3.  
  4. function OnGUI () {
  5.  
  6.   //background box
  7.   GUI.Box (Rect (10,130,100,90), "Sounds");
  8.  
  9.   //Make first button
  10.   if (GUI.Button (Rect(20,160,80,20),  "Go")){
  11.    audio.clip = track;
  12.         audio.loop = false;
  13.  
  14.       audio.Play();
  15.  
  16.   }
  17.  
  18.   //Make second button
  19.   if (GUI.Button (Rect(20,190,80,20),  "Stop")){
  20.  
  21.       audio.Stop();
  22.  
  23.   }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment