simultaneous animation clips

Hey guys,

I’m having a problem where Play’ing multiple procedurally-generated AnimationClips simultaneously causes them to cancel each other, with the result that only the last AnimationClip I play is actually running. I’d like them to all run simultaneously, for instance to animate material properties like color and uv offsets at the same time.

I’m setting stuff up much like this code:

I build an AnimationClip for each property by adding a curve for each sub-property (i.e. r, g, b, a), then add the clip to the animation component.

For instance, if I use Animation.Play to start the clip containing the color curves, then again on uv offsets the result is only the uv offsets will actually animate.

I’m unsure how the API should be used to tell Unity that I want to play all animations simultaneously with no mixing required (since they have nothing to do with animating vertices attached to bones).

I tried setting the blendMode property to additive with no luck. I tried using the Blend and CrossFade functions with a really long blend time also with no luck.

Anyone with any bright ideas how to make this work?

Blend mode doesn’t really help you if you aren’t using the animation function that blends. Play overwrites all other animations in the same layer or lower layer, so it ignores all blend preferences. What you should be trying to use is animation.Blend();.

Hmmm I did try using Blend with a time of 100.0 seconds. Were you able to get something similar to work using Blend?

Blend time tells you how long it takes to fully blend the animation. If you set it to 100, it won’t fully blend until 100 seconds are past and generally will stop blending upon hitting the end of the animation. If you want them to all play simultaneously, you need a small blend time like .3.

Yeah, I wrote a utility for testing animations a while back, and it used all the animation functions + configuration of each of the variables involved. Allowed me to figure out the perfect settings for special actions. However, I set the wrapMode for each animation to Loop when I wanted them all to move together, so that might have something to do with it.

Oh, you’re right I wasn’t using Blend properly. I’ll give it a try later tonight.

[edit] Yep… that was it. Thank you! :slight_smile: