- Home /
Animation cant be found even if attached to object?
Hi Unity Answers, I am having a difficult time getting animation to work. I attached the animations to my objects and wrote in the correct lines of code for it to work, but something is wrong. It keeps saying "the animation state "RUN" cannot be played because it cannot be found", "Please attach an animation state with the name RUN to this object". But if you look at my object... it already has run attached. See img below
The (simplified) script I have is...
public class AstarAIranger : MonoBehaviour {
private AnimationState run ;
public void Update(){
animation.Play ("run");
}
}
Is it because its in the resources folder? When I click on the animation it highlights the resources folder so it knows its in there, but maybe the script does not? Do I need to identify the path? If so, how do you do this. Any help would be appreciated, im sure this is a quick fix and easy answer point! Thanks,
~Cam
Answer by camtronius · Aug 12, 2014 at 07:48 PM
I was not using animator correctly. I wasnt aware that you had to run animations through the animator.