Whats wrong here?

I have this script
to open a door

var OpenAnim : AnimationClip;
var CloseAnim : AnimationClip;

var OpenSound : AudioClip;
var CloseSound : AudioClip;

function OnTriggerEnter () {

	animation.Play(OpenAnim);
	audio.PlayOneShot(OpenSound);

}

function OnTriggerExit() {
yield WaitForSeconds(5);

	animation.Play(CloseAnim);
	audio.PlayOneShot(CloseSound);

}

but i get this: No appropriate version of ‘UnityEngine.Animation.Play’ for the argument list ‘(UnityEngine.AnimationClip)’ was found

So whats wrong?

Is there no way to use a variable to specify an animation? Do I have to name the specific animation?

if you look at the doc linked by Alexey you’ll see that the parameter to specify an animation has to be string not an AnimationClip…

old thread, but found it when I had this problem and don’t like the “answers” provided here so here’s the very simple solution I found to get the animation clip’s name in a string:

animation.Play(OpenAnim.name);