2
\$\begingroup\$

I'm in the beginning of a project and I'm not really using 3D models but rather a hierarchy of primitive shapes. I made a couple of animations that suddenly don't work anymore. I get an error about that I need to mark them 'legacy'.

I came across this suggestion to mark them as legacy in the rig tab via the model, but I'm not using a model so that doesn't help.

I don't understand how the animations that I made in Unity yesterday don't work today? What is this legacy problem?

\$\endgroup\$
  • \$\begingroup\$ Well I don't know exactly what's going on, but I'm guessing it's because you're "not really using 3dmodels but rather a hierarchy of primitive shapes." That's a pretty old fashioned approach to animating, so maybe Unity considers that Legacy now? \$\endgroup\$ – jhocking Nov 22 '13 at 17:11
  • 1
    \$\begingroup\$ oh and as for why the animations you made yesterday suddenly don't work today, did you update Unity since yesterday? Perhaps this Legacy animation change was made in the latest version of Unity. Otherwise, yeah that's pretty odd; Unity is great most of the time, but it does odd things in obscure places. \$\endgroup\$ – jhocking Nov 22 '13 at 17:37
  • \$\begingroup\$ Here is the right answer answers.unity3d.com/questions/581261/… \$\endgroup\$ – Daarwin Nov 24 '13 at 5:11
4
\$\begingroup\$

To make sure this question has an answer on GD:SE to help others when searching I'm posting the link you mentioned:

http://answers.unity3d.com/questions/581261/animations-suddenly-need-to-be-marked-legacy.html

To quote:

I've recently ran into this exact same problem and I've found 2 ways to solve my issue, so I'm hoping I can help you.

EDIT


This post is becoming aged but keeps popping up so I'll add an edit. Since the original post I've been made aware of an easier way to mark your animation files as Legacy:

Project window, then go to the top right corner of the Inspector window and select Debug from the drop down menu (next to the lock), then change the Animation Type to 1 will mark it as Legacy.

Screenshot from Unity 5.3

I'm not sure if you did, but when I created my original animation files, I did so inside of the "Project" window. Try adding an animation component to the sprite you want to animate, then open the animation window and select "[create new animation]" in the drop down menu. Doing it this way seems to create the new animation with the legacy animation flag set. This way you can completely avoid the warning or need for editing animation files. I hope this solves your issue, I know how frustrating it was for me.

\$\endgroup\$
  • 1
    \$\begingroup\$ Link-only answers are bad, since the links may break in future. \$\endgroup\$ – o0'. Jan 6 '14 at 14:54
  • 1
    \$\begingroup\$ @Lohoris edited to quote, better? \$\endgroup\$ – Tom 'Blue' Piddock Jan 6 '14 at 15:15
1
\$\begingroup\$

If you don't want to mark your animations as legacy, you can use the new Playables API to play non-legacy AnimationClips:

private List<PlayableGraph> graphs = new List<PlayableGraph> ();

// Just call this function when you want to play an AnimationClip on a specific GameObject.
// from https://docs.unity3d.com/Manual/Playables-Examples.html
private PlayableGraph playAnim(AnimationClip clip, GameObject obj) {
    PlayableGraph playableGraph;

    AnimationPlayableUtilities.PlayClip(obj.AddComponent<Animator>(), clip, out playableGraph);

    // save all graphs we create and destroy them at the end of our scene.
    // you might need to optimize this if you make a lot of animations.
    graphs.Add (playableGraph);

    return playableGraph;
}

void OnDisable() {
    foreach (var g in graphs) {
        g.Destroy();
    }
    graphs.Clear ();
}
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.