Simple animation on game object doesn't play via animation.Play

Hot to reproduce the problem:

  1. create a cube or any other primitive (also an empty object works). Let’s say we call it MyObject

  2. open the animation window and create a new clip. Let’s say we call it anim01

  3. attach an Animation component to the object and make sure that the anim01 is selected and appears in the list.

  4. create a C# script with the following start function

    void Start () {



This will give the following warning:

The AnimationClip ‘anim01’ used by the Animation component ‘MyObject’ must be marked as Legacy.
MyScript:Start() (at Assets/Scripts/MyScript.cs:10)

…and the following error:

The animation state anim01could not be played because it couldn’t be found!
Please attach an animation clip with the name ‘anim01’ or call this function only for existing animations.
MyScript:Start() (at Assets/Scripts/MyScript.cs:10)

I just need to make a simple cube move with an animation. This, if am not wrong, was the way to play an animation before Unity 4.3? Is something changed? Am I missing something?
Please help.

Thank you.

If you had this issue it’s very likely that you created the clip in Unity with the wrong format.

Animations, better said clips in this case, made for the Animator component aren’t compatible with the Animation component. If you drag and drop a .anim asset that was created in Unity for Animator into an Animation clip slot it will not give you any fatal error but it won’t play when it’s supposed to.

In order to create an animation for the Animation component on a game object,

  1. Add an Animation component to your game object.
  2. Open the Animation window (not Animator) making sure the target game object is selected.
  3. Create and save a new Clip.

Doing so you created an animation in the legacy format, which is compatible with the Animation component.

For similar reasons when you import animated objects from FBX or other formats, if you want to use the Animation component, you need to set the animation import to Legacy.

Hope this helps.