I’m new to scripting with animations and I’m trying to get the animations current time so I can play the next Idle animation. The only problem is, when I type in anim["Idle"].normalizedTime
(like I see everyone else do) I get the following parse error: “Unity.Animator does not contain a definition for normalizedTime”. Heres my code:
Animator anim;
float random;
string currentAnim;
void Start () {
anim = gameObject.GetComponent<Animator> ();
}
void FixedUpdate () {
if (anim[currentAnim].normalizedTime == 1.0f) {
Debug.Log ("done");
random = Random.Range (0f, 2f);
if (random > 1.0f) {
currentAnim = "idelR";
anim.runtimeAnimatorController = Resources.Load ("Models/animationsdump/greekRowers/idelR") as RuntimeAnimatorController;
} else {
currentAnim = "idel2R";
anim.runtimeAnimatorController = Resources.Load ("Models/animationsdump/greekRowers/idel2R") as RuntimeAnimatorController;
}
}
}
Even when I type in the animation like [“idle”] it still gives the error. What am I doing wrong?