Mirror animation clip through script

Hello guys,

how can I mirror an animation clip in mecanim through script??
basically I want to be able to switch between original and mirrored version of the same clip in runtime.

thanks…

Duplicate your animation and set the speed to -1 to play it backwards.

1 Like

this is not mirroring.

Mecanim has a ‘mirror’ checkbox for 3d animation clips. Just copy the animation and check the box. For 2d sprite based clips, this doesn’t work. I’ve created a feature request to fix this, as I don’t think it’s a bug: http://feedback.unity3d.com/suggestions/2d-allow-mirror-flag-in-mecanim-to-be-used-with-sprite-animations

Yes, but how do you do this in script?

Hi , @Straafe
did you find a solution ? (if you remenber 5 year after :))

I wrote some scripts to help reverse clips in the editor over the years, not sure if you need to do it in runtime. There is also a script in there that shows how to create behaviors in the Animator state machine. https://github.com/Straafe/unity-editor-tools

how can i enable mirror boolean through accessing animator???

and also how can i change the speed of animator by script while in playmode?? i can make parameter of float and change the speed, but i want the main speed to change into negative value if i want, bcz if its doing ni forward way and in loop then it starts playing in backward way as same speed without doing any jerk or any other kind of issues

you can you need give a value check this video