Animation Help Needed (Method Not Found)

I am trying to add a walking animation to my charachter but when I try it says “MissingMethodException: Method not found: 'UnityEngine.Animation.play” I dont know what to do.
here is my script

var character: CharacterController;
var speed: float = 5.0;   // moving speed
var direction: float = 1; // direction (-1 means -x)
var directionback: float = -1;
var runanimation: AnimationClip;
var placeanimation: AnimationClip;
var attackanimation: AnimationClip;
var dieanimation: AnimationClip;

function Start(){	
    	character = transform.GetComponent(CharacterController); 	
}

function Update(){
	if(Input.GetKey("d")){
    	character.Move(Vector3.forward * speed * direction * Time.deltaTime);
    	animation.play(animation.clip.runanimation);
    	}
    if(Input.GetKey("a")){
    	character.Move(Vector3.forward * speed * directionback * Time.deltaTime);
    	}
    if(Input.GetKey("w")){
    	character.Move(Vector3.right * speed * directionback * Time.deltaTime);
    	}
    if(Input.GetKey("s")){
    	character.Move(Vector3.right * speed * direction * Time.deltaTime);
    	}
}

can someone plz help me. I have no idea what to do.

You need to spell ‘play’ with a Capital P!

Also, animation.clip.whatever isn’t the correct way of getting the animations- you should use whateverYouCalledYourAnimationClip.name; - this returns a string which can be plugged into animation.Play.

Like so-

animation.Play(runanimation.name);
animation.Play(attackanimation.name);

Your problem here is that you made a mistake that can be easy to make.

To play your animations, you wrote animation.play(). What you should have written was animation.Play() with a captial P!!!

Just swap every animation.play() with the capital P. Here is the script reference for animation.Play(): http://unity3d.com/support/documentation/ScriptReference/Animation.Play.html

Hopefully this will fix your issue!!! :smiley:

If not, then comment back and I will try and help you more!

-Grady