- Home /
How to Record or Play an animation backwards
I know this question has been asked before but it all involves using the Animation(?) component, so that is no longer any good in Unity 5.3.1f1, I explain a bit more later.
I'm trying to simply get an animation to play backwards. On the object that I want to have an animation play backwards on, I have an animator.
private Animator anim;
...
anim = GetComponent<Animator>();
If I do:
animator.speed = -1.0f;
It tells me Animator.speed can only be negative when Animator recorder is enabled. Animator.recorderMode != AnimatorRecorderMode.Offline
So I try putting on an Animation component on the game object, and making the clip the animation.
Every time I do anything with the Animation component in script, it tells me the component must be marked as Legacy. That is no good, because when I tried making it Legacy it caused multiple problems including not being recognized by the Animator. Also GetRef errors. The entire Animation component seems like it's treated as legacy now or is just broken.
So I decided well maybe I could just try to get the animation to play backwards in the animator and having the animator record it, and then using that backwards recorded animation in the actual game. I cannot figure out how to this, even if I click record in the Animation view anim.recorderMode != AnimatorRecorderMode.Record. I don't know what to do. All I want to do is play the same animation backwards without having to copy and paste an animation in the Project and moving all of the keys around so that they are reversed. Please help. Unity's animation system seems so convoluted in script.
Answer by ItsIcear · Feb 10, 2016 at 05:38 PM
When a animation is marked as "Legacy" it cannot be used as part of an animation state. Try adding an "Animation" component to your gameObject then settings the animation speed to "-1f" using a script. Also, remove the "Animator" component from the gameObject