I have a 2D animation handled by the Animator (walking forward) that I want to play in reverse when walking backward.
This should be simple to do but is so far eluding me. I figured out I can flip the Animator.speed value to -1 to play it in reverse but this causes a glitch where the animation plays in reverse for a while but then gets stuck on the first frame and there is no clear reason why this is happening. I checked my code and it has nothing to do with an error in the code itself.
Searching around I found a few ‘solutions’ that involve duplicating the ordinary forward STATE and setting its Speed to -1 but the solution is very inelegant for a bunch of reasons. Also, being able to simply reverse the forward animation allows me to start going backwards from whatever frame is currently active, yielding a much nicer looking result. Any help is appreciated!
And in the animator I just added StrafeDirection as a parameter, and in the particular state that handles the animation I set the Speed multiplier to the StrafeDirection parameter. Easy! Wonder why it took so long to add this…
I can’t use -1
I get this warning on console ! using Unity 5.3
Animator.speed can only be negative when Animator recorder is enabled. Animator.recorderMode != AnimatorRecorderMode.Offline
Also see this
In Unity 5.3.1p1, if I set the speed of an AnimationState in the MecAnim Inspector to -1, my animation isn’t starting at the very end of the animation (it’s 1 second, 20 frames long). I added AnimationEvents and I only see the ones fired at 1 second (1:00) and then backwards to the start of the animation (0:00). The animation frames past 1:00 never play and any corresponding AnimationEvents set past 1:00 never fire.