Log in or register to post comments

How to enable sound on button pressed?

November 14, 2014 - 9:48am #1

I currently creating an apps for my final year project. im using unity3d and vuforia.i manage to play with the vuforia single target marker. but i really not good in coding. my question is..i try using a script i download from internet for playing sound when mouse up.the script also enable to switch between scene. but the problem is..why the button only functioning for switch scene only but not playing the sound. 

 

the code is like this

 

 
var levelToLoad : String;
 var soundhover : AudioClip;
 var beep : AudioClip;
 var QuitButton : boolean = false;
 
 function OnMouseEnter(){
     audio.PlayOneShot(soundhover);
 }
 
 function OnMouseUp(){
     audio.PlayOneShot(beep);
     yield new WaitForSeconds(0.35);
     if(QuitButton){
         Application.Quit();
     }
     else{
         Application.LoadLevel(levelToLoad);
     }
 }
 
what i need to do to make when i display a marker..the button that i pressed on screen will play a sound.
Log in or register to post comments