Log in or register to post comments

Button not playing sound ?

November 14, 2014 - 9:51am #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. sry for the bad english

Button not playing sound ?

November 15, 2014 - 12:25pm #2

Not sure if this the case, but have you apply a collision box on it with the 'on trigger' checked?

Log in or register to post comments