KybernetikGames / animancer

Documentation for the Animancer Unity Plugin.
63 stars 8 forks source link

How to play animation once? :D #321

Closed wrymn closed 8 months ago

wrymn commented 8 months ago

This is just a simple request, however I just cannot get it working, asked chatgpt, google and searched documentation and code API.

How to play animation once without it looping?

I just want to Play(clip), and then when animation finishes, I want the animator to be just idle. Because not I call Play() on some animation (.e.g. attack) and it just loops forever. I have only 1 animation, there is no idle to switch to.

KybernetikGames commented 8 months ago

To make an animation not loop, you need to untick Loop Pose in its import settings. That will cause it to freeze at the end of the animation instead.

If you also want it to return to an idle pose, you will need an idle animation.

wrymn commented 8 months ago

Indeed, this worked, thank you. This is very important info, not sure if I missed it in documentation, but in case this is not present, it really should be added.

Also it seems when playing non-looping animation, the Play() won't work for the second time, so its essential to also set the state to Time of 0 after playing any non-looping animation.