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?

1 Answer

1

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.

how would you do this in java