Created
August 7, 2020 22:13
-
-
Save SiarheiPilat/9b4dc09940db9e7ced4dfadd0de3dcea to your computer and use it in GitHub Desktop.
Proper way of reversing animation playback in Unity when using legacy animation system ('Animation' component; when you need to play it backwards).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| public class ReverseAnimationLegacy : MonoBehaviour | |
| { | |
| Animation Animation; | |
| void Start() | |
| { | |
| Animation = GetComponent<Animation>(); | |
| Animation["walk"].speed = -0.25f; | |
| Animation["walk"].time = Animation["walk"].length; | |
| Animation.Play("walk"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment