Animation script error

I have this particular animation that goes from 0:00 to 8:10 in the animation window editor. I just want to play 1:20 to 8:10 so i want to make a script that plays only that section of it.

So here’s what I have:

using UnityEngine;

using System.Collections;

public class mirror_noSpikes_AnimControl : MonoBehaviour {

// Use this for initialization
void Start () {
	
		Animation["Take 001"].time = 1.2;
	
	
}

// Update is called once per frame
void Update () {

	if(Animation["Take 001"].time <= 1.2)
	{
		
		Animation["Take 001"].time = 1.2;
		
	}
	
	
	
}

}

The problem is that it throws this error:

Assets/custom assets/mirror_noSpikes_AnimControl.cs(13,25): error CS0119: Expression denotes a type', where a variable’, value' or method group’ was expected

Can anyone help me with this problem? Thanks.

Kelp could be right but it could also be the fact you are using Animation instead of animation. Animation references the class while animation reference the component which is a short cut for gameObject.GetComponent(). This is all under the assumption that you have an animation component attached to the GameObject this script is attached.

Hope this helps!

Adam