Hello everyone!
When I press the left mouse button on a box collider should animate a second animation. when I press the button I get this cluster error:
Invalid Layer Index
UnityEngine.Animator: Play (String)
$: MoveNext () (at Assets / x ninja / Code / Upload blocking livello.js: 18)
UnityEngine.SendMouseEvents: DoSendMouseEvents (Int32, Int32)
What could be the problem?
script:
var levelToLoad : String;
var soundhover : AudioClip;
var beep : AudioClip;
var QuitButton : boolean = false;
var anim : Animator;
function Start()
{
anim = GetComponent("Animator");
}
function OnMouseEnter(){
audio.PlayOneShot(soundhover);
}
function OnMouseDown(){
anim.Play ("Secondo");
audio.PlayOneShot(beep);
yield new WaitForSeconds(15);
if(QuitButton){
Application.Quit();
}
else{
Application.LoadLevel(levelToLoad);
}
}
@script RequireComponent(AudioSource)