Unity 5. Reverse animation play ?

Hello. How do i play animation in reverse? i been searching in internet and i found this:

animation["Zoom"].speed = -1;

but its outdated now or i am doing this wrong. How do i play animation in reverse using unity 5? i start animation like this:

bonuspanel.GetComponent<Animation> ().Play ();

soo it should be the same just like this:

bonuspanel.GetComponent<Animation> ().speed = -1;

But speed does not exist. I hope someone can help me :slight_smile:

The solution by careyagimon is in this forum thread playing animation backwards.

It states:

I think you need to set when the animation is playing from first. Playing it backwards from 0.0 doesn’t do anything. You need to play it backwards from the end of the animation.

Code (csharp):

hand.animation["bridge"].speed = -1;
hand.animation["bridge"].time = hand.animation["bridge"].length;

Even better is if you can set the wrap mode to ClampForever. Play the animation once at speed 1 and then set the speed to -1 to reverse back to the starting state.

Despite what Jasper_Moore said about speed multipliers, they worked for me.

Here’s what I did:

  1. Add a float parameter to the Animator (I called it “Direction”). Initialize its value to 1.0.

  2. In the relevant animator state (in my case “Walking”), link the float parameter to the speed multiplier, like so:

  3. In your script, set the float parameter to -1.0 (for backwards) or 1.0 (for forwards), like this:

animator.SetFloat(“Direction”, -1.0f);

While it would make sense to simply change the playback speed, or to create a float value in the animator for a speed multiplier, I have found it to be very inconsistent and buggy, if it works at all. The only consistent method I’ve found is stepping through the animation manually, like so:

public Animator myAnim; //Animation controller, assign in inspector.

private float animTime; //Tells us where we are in the animation’s timeline.

private bool anim_Play; //Should the animation play?

void Update()

    if (anim_Play && animTime < 1)           //If animation is toggled on
        animTime += 0.3f * Time.deltaTime;   //Increase animTime, Don't let animTime go beyond 1
    else if (!anim_Play && animTime > 0)     //If animation is toggled off/reversed
        animTime -= 0.3f * Time.deltaTime;   //Decrease animTime, Don't let animTime go below 0

    myAnim.Play("Some_Animation", 0, animTime ); //Step through animation manually


//Call this function to toggle forward/reverse.
public void ToggleAnim()

    anim_Play = !anim_Play;


This is a simple setup for a single animation (in my case, a door opening/closing). The animation will automatically idle at beginning and end. If you want it to do something else after playing, you’ll have to experiment to work that out. Also, I used 0.3 for the speed multiplier, this can be adjusted to fit your needs. Hope this helps anyone having this problem!

Just to be clear, Here is what my animator view looks like for this setup:

This is how i do,mine is quite straightforward

private animatior anim;

private float direction;

void update ()

     if (Input.GetKeyDown("space"))
        anim.SetFloat("Direction", -1);
        anim.Play("WAIT02", -1, 0f);


and you must set a float parameter in the animator (a transition) , in my case it’s named direction.

hope it works for you