- Home /
Not a question, but an answer
How do you play an animation in reverse?
I think I may have found an easier method to play animation in reverse than the forum posts I've read. In the Animator you can add a float parameter "Modifier". Once you've done that inside the Inspector for your animation state you can check the Parameter box next to the multiplier property and associate it with the Multiplier parameter you added to the Animator. Then through script you can simply change the Modifier parameter similar to below:
private Animator animator;
float movementDirection;
...
void Update()
{
animator = GetComponent<Animator>();
if (Input.GetKeyDown(KeyCode.DownArrow))
{
movementDirection = -1.0f; //Reverse
}
if (Input.GetKeyDown(KeyCode.UpArrow))
{
movementDirection = 1.0f; //Forward
}
animator.SetFloat("Multiplier", movementDirection);
}
Hope this helps!
[1]: /storage/temp/101789-2017-09-13.png
bravo !!! it's working fine and very easiest than what I know ,thanks dude.
Follow this Question
Related Questions
Easier way of creating transitions in the animator? 1 Answer
How to get fileID information so i can just edit Mecanim Animator through script? 2 Answers
Animator does not play Animation on object 1 Answer
How do I make the transition between two states in the "Animator" happen instantly? 3 Answers
Is it possible to make empty, passing state in mecanim? 3 Answers