Quantcast
Viewing latest article 8
Browse Latest Browse All 30

Answer by KevinCodes4Food

For those searching for a solution to use PingPong only once, without repeating, I have seperate solution post here: [Ping Pong Only Once][1] In terms of playing an animation just forward, then just backwards on a key stroke, which seems to be the actual intent of the query in this posting, here is a complete C# implementation derived from DaveA's clever answer above. bool isOpen = false; void Update() { if (Input.GetKeyDown(KeyCode.K)) { isOpen = !isOpen; if (isOpen ) { animation["open"].time = 0; animation["open"].speed = 1; } else { animation["open"].time = animation["open"].length; // Start at the end... animation["open"].speed = -1; // ...and run backwards! } animation.Play("open"); } } [1]: http://answers.unity3d.com/questions/291732/play-animation-forward-than-immediately-backwards.html#answer-693278

Viewing latest article 8
Browse Latest Browse All 30

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>