- Home /
Why is Animation Not Playing in Reverse?
Not sure what I'm doing wrong here. I have this code in a function, when it's called I would like this animation to play backwards at twice the speed of normal.
Here's my code:
animation["playAnimationPlease"].layer=10;
animation["playAnimationPlease"].wrapMode = WrapMode.Once;
animation["playAnimationPlease"].speed=-2;
animation.CrossFade("playAnimationPlease");
I can verify that the function gets called, and it does but the animation doesn't play.
Any ideas?
Thanks!
Answer by ByteSheep · May 16, 2013 at 12:19 AM
As this forum post shows, you need to set the animation time to the end of the animation clip before playing it:
animation["playAnimationPlease"].layer=10;
animation["playAnimationPlease"].wrapMode = WrapMode.Once;
animation["playAnimationPlease"].speed=-2;
animation["playAnimationPlease"].time = animation["playAnimationPlease"].length;
animation.CrossFade("playAnimationPlease");
Please always do a google search before posting here to make sure the question hasn't already been answered.
Thanks, I've done a lot of Google Searching and still have not found what I'm doing wrong.
Have you already tested it with the added line
animation["playAnimationPlease"].time = animation["playAnimationPlease"].length;
Answer by ShinyTaco · May 16, 2013 at 01:00 AM
Thank you. Yes, I saw that post, it was my error. Apologies for beating a dead horse.
Your answer
Follow this Question
Related Questions
Help With Animation Play Back - Reverse 1 Answer
[Unsolved] Playing animation backwords [Unsolved] 1 Answer
Playing several animations 1 Answer
Set up Animator with specific seconds 1 Answer
Button to play animation in reverse 1 Answer