Getting weird behaviour when blending animations of behaviour fields

I’m trying to animate fields in a few components that are children of my main object.

i.e. I have Hero, and under Hero there is a Sword which has a behaviour attached to it that changes texture based on a float field (textureIndex) it contains. Additionally, the player has a Shield set up in a similar way. Using the animation editor, I can create an animation clip that animates textureIndex, and is authored from the perspective of the hero (i.e. it animates the relative path ./Sword.Getcomponent.textureIndex. I author the clip for the Hero because I am using Animation Events to call functions on the hero when the animation finishes. I can then play the animation clip on the hero and see the textureIndex change (as well as seeing the texture change), in addition to receiving the animation events - wonderful!

The problem I am having is that If I try to play a similar animation clip which animates the shield’s textureIndex, it will stop playing the clip that animates the sword.

Simple enough, I just need to call animation.Blend(“ShieldAnim”) rather than animation.Play(“ShieldAnim”). This works fine the first time I call blend on a clip, but subsequent calls start behaving oddly. Sometimes it will play the animation twice in rapid succession, and I often times no longer receive the animation event.

Has anybody else run into this? Any advice? Right now I’m looking into writing my own animation system to bipass Unity’s AnimationClip system, but I’d rather not go through that.

Thanks!

If I understood your problem correctly, you just have an animation layer problem, as in: animations need to exist in different layers if you need to blend them together, otherwise the last played one will override all the others.