- Home /
animation.CrossFadeQueued, Playback speed glitch.
Hey there!
I've been doing a bit of experimentation and have found that the CrossFadeQueued method doesnt take the animationstate speed into account, however the Play command does.
To replicate this do the following;
void Awake() { objanimation["walk"].speed = 2f /*.. removed from awake */ }
public void Update() { if(!objanimation.isPlaying("walk")) { objanimation.Play("walk"); } }
The above will work fine and play the animation back at twice speed, however replace this with the following
void Awake() { objanimation["walk"].speed = 2f /*.. removed from awake */ }
public void Update() { if(!objanimation.isPlaying("walk")) { objanimation.CrossFadeQueued("walk",0.2f,QueueMode.PlayNow); } }
And it won't work at all, it will just play back at the normal speed? Any ideas?
Answer by Paulius-Liekis · Apr 02, 2011 at 07:44 PM
You misinterpret things. CrossFadeQueued is not supposed to clone properties from "original" state, it only finds clip with same name (at least as far as I remember). You can always do this:
AnimationState newWalk = objanimation.CrossFadeQueued("walk",0.2f,QueueMode.PlayNow);
newWalk.speed = 2;
This still feels a little strange, you would have to reset all of the speed values each time you call that animation?
Actually you're right. Animation state is supposed to clone everything, but it doesn't. It seems to clone only clip, layer and name. I'll raise a bug on this. At the moment you will have to set the properties yourself after cloning.
Your answer
Follow this Question
Related Questions
Stop Animation State in Animator from Speeding Up after Playing it a Second Time? 0 Answers
First script plays animation but second script stops if from playing said animation 1 Answer
Allow Unity to render as fast as possible? 0 Answers
How do I adjust the speed of an animation when preparing a CMU Motion Capture in Blender 2.68? 0 Answers
Character Controller Component, Gravity/inertia, and Root Motion 0 Answers