I have a gameObject with attached animation component, and have added animationClip1.anim with it.
I have the following code
public AnimationClip anim;
void Update () {
if (Input.GetButtonUp("Fire1"))
{
GetComponent<Animation>().Play(anim.name);
}
}
from interface, i have drag and dropped animationClip1.anim to the (above public variable) of the script..
Script is attached to the object.
So when i run the game, i get this error
The animation state 'animationClip1.anim' could not be played because it couldn't be found! Please attach an animation clip with the name 'animationClip1.anim' or call this function only for existing animations.
Where is the problem, why on mouse click i am getting this error.. Any Idea please ? Thanks
animationClip1.animactually the animationclip or is it justanimationClip1? – Gunnar B. 1 hour ago