How to rewind animation (with Animator) from current time and position? For sprite sheet 2D animation.
Use Animator.Play(0,-1, myCurrentTime);
It will set the time of the current playing state.
myCurrentTime, what this? How to know current animation time?
Third parameter in Animator.Play() set the time, but how to play rewind (set speed to -1)?
ah you want to play the clip in rewind mode, sorry I misunderstood your question.
You can only set the Animator state speed in the editor. So if you need to play a clip both in forward or rewind mode you need to create two different state with the same clip and set state’s speed to 1 and -1.
How to add event only to reversed clip (which copied from forward speed clip)?
I’m not sure I understand the question, You would like to add animation event only on the reverse clip? since it the same clip but only played in reverse it should fire the same animation events but in reverse order
Is it possible to add and remove event programmatically?
yes, you can even do it at runtime.
If you want to add event that need to be persisted on your Animation Clip use
If you want to add event at runtime only use
You guys are fantastically helpful!