Unity.Animator does not contain a definition for normalizedTime

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?

Animator does not have a normalizedTime property nor does it have an indexer (so you can’t do anim[“Idle”]). I’m guessing that you are incorrectly using Animator when you want to use Animation.

Looks like you are mixing Animator component with Animation code, which is the Legacy system. Check out the Mecanim scripting section for updated code.