Animation state not found

Hi!

I’m making a 2d platform game where I would like my character animated when he idles, walks, etc. I made a test-animation called “idle” in Cinema4D, and imported my character into my game. Now, I see the animation named “idle” when I add an animation-component, but for some reason nothing is playing when my character is idling in the game, and I’m getting an error saying: “Animation state idle could not be played because it couldn’t be found”

I have scripted the part that runs the animation in javascript, and the script is of course attatched to my character.

function Start(){
	animation["idle"].layer = 0; animation["idle"].wrapMode = WrapMode.Loop;
}

function Update(){
	if(Input.GetAxis("Horizontal") == 0){
		animation.CrossFade("idle");
	}
}

Any ideas what I can do now?

I am not sure but the only thing i could think of is that you have named it wrong… like ldle instead of idle

Or, you might be on a component that it isn’t visible, I think the script has to be on the animation component.