- Home /
Need help playing animation in reverse
So I'm building a very intricate machine model that has thousands of animated parts the user can activate.
Each part only has one animation, "take off" or "open" which is pretty simple. I can get the animation to play in one direction "take off" with this
animator.Play("part351animation");
but I can't for the life of me figure out how to get it to play in reverse.
I've tried animator.speed = -1f;
but it just spits out console errors about the recorder not being enabled.
I can manually set the speed on the animation via the inspector but I can't figure out how to access that property via code to switch between 1f and -1f.
I've also tried animator.SetFloat("Speed" -1f);
but it says that paramater does not exist. I know I could manually use the mechanim to create different states but with thousands of parts it would take me ages for something that seems like it should be simple.
In a perfect world I see it being animator.Play("part351animation", -1f);
where -1f is speed.
I'd like a code solution that I can put into place without having to reimport all of my animations differently or setting them as legacy.
Answer by PhantomSarcasm · Aug 18, 2016 at 03:26 PM
if not getting the parameter in the animator. if it says that the speed parameter is that there is not as created and to make the animation work to a floating vase have to make it multiply in the inspector.
This works but only as a workaround, it would mean that I still have to go back and manually change thousands of animations and if I started a new project I would have to change thousands more.
Thank you for your answer though.
I do not know if there is any way to return all the animation with a single command, but it is the most viable. you could use Time.TimeScale = -1;
to make it back off everything but is not very profitable for receding all ... Like good eh not always use tried the code "0" or "1" to stop and move again as sort of pause
I can't believe Unity doesn't expose this with the Animator, with legacy animations its easy. I guess it's because people wanting to automate their animations strictly from code are the $$anonymous$$ority.
Your answer
![](https://koobas.hobune.stream/wayback/20220612091053im_/https://answers.unity.com/themes/thub/images/avi.jpg)