My problem is that I am trying to get my animator to trigger a state on it but I don’t know how to call the state. I am not trying to call this with a click or a button press. I just want the script to fire it off for me. I have provided my script below as you will see.
#pragma strict
//private var state = 0;
internal var animator : Animator; // var to store the animator component
var idle : GameObject;
var scratch : GameObject;
var idleSound : AudioClip;
var scratchSound : AudioClip;
var enabled = true;
function Start () {
animator = GetComponent(Animator); // assign the Animator component
//Animator.Play(idle: string, Mouse.Base Layer: int = -1, 1: float = float.NegativeInfinity): void;
Animator.Play ("idle");
//if (Animator.isPlaying)
//audio.Play(88200);
audio.PlayOneShot(idleSound);
//yield WaitForSeconds(1);
//if (!Animator.isPlaying)
Animator.Play ("MouseScratch");
//if (animation ["MouseScratch"].enabled == true){
//if (Animator.isPlaying);
audio.PlayOneShot(scratchSound);
}
function Update () {
//if (state == 0){
// state = 1;
// return;
//}
}