Problem with animation code or blender?

I imported a blender file (a basic running animation)into Unity as a .FBX file.

I’ve used some code which i thought might play the animation when a key is pressed, but im just getting an error message: “unknown identifier: ‘blockgoatrun’” ('blockgoatrun’being the name of the blender model import).

Here is the code:

var Speed = 5.0;

function Update () {

if(Input.GetKey(“d”))
{transform.Translate(transform.forward * Speed * Time.deltaTime); animation.Play(blockgoatrun);
}
}

Why isn’t it recognising the file?

I know im making some fundamental error as i am still new to all this, im just buggered if i know what it is!

Thank you, Tom.

If that’s your complete code, the problem is that you’re calling Play on the animation stored in the variable blockgoatrun which probably doesn’t exist. Check out the docs on Play() here.

If the animation is attached to the gameobject already, just replace animation.Play(blockgoatrun) with animation.Play("blockgoatrun"). Play requires a string.