- Home /
Using wrapmode.once and speed cuts animation prematurely
I'm having an issue here with the animation stopping at the point defined in speed. For example, setting the animation speed to 0.5f will make the animation play at half speed, but stop half way through the animation on a "WrapMode.Once" animation. How can I get the animation to play through entirely?
Animation[Name].speed = 0.5f;
Animation[Name].wrapMode = WrapMode.Once;
Animation.CrossFade(Name);
Answer by almo · Jul 22, 2011 at 03:10 PM
Try WrapMode.ClampForever
I had the exact same problem, crossfade always works for looping animations, but if you are crossfading to an animation playing once, Wrap$$anonymous$$ode.Once isn't good enough. ClampForever is the solution. Thanks a million @almo I wouldnt' have found it.
While this does work, it has the unfortunate drawback of the animations never resetting themselves. This means that state.isPlaying will remain true (totally understandably) and that further calls to CrossFade will not replay the animation if it was already playing.
One might think that StopSameLayer or StopAll would stop it, allowing it to be played again, but one would be wrong. :( Any further ideas on how to properly play an animation once at a specified speed?
Your answer
Follow this Question
Related Questions
Can I make animations snap to a frame? 1 Answer
How can I get animation state speed in code 1 Answer
Clamp animation to a certain amount of time? 1 Answer
Control animation speed with slider 4 Answers
Set walk animation speed to velocity 1 Answer