Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

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

share|improve this question
    
Is animationClip1.anim actually the animationclip or is it just animationClip1? – Gunnar B. 1 hour ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.