Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Custom Avatar Mask not working - no animation playing at all

Discussion in 'Animation' started by LeFx_Tom, Sep 9, 2021.

  1. LeFx_Tom


    Jan 18, 2013

    I'm struggling with the AvatarMask/Animation layer system and i don't fully understand, what I'm doing wrong here.
    This is the situation:

    • I have an animated mesh of a non-humanoid thing (a machine), which imports as generic rig and creates it's avatar from imported mesh
    • We added some extra game objects to the hierarchy in prefab and duplicated/modified one of the animation clips that was imported. The clip itself plays back fine when scrubbing through it and all objects move as they are supposed to.
    • We want to add this animation on an extra layer and use an animation mask, to make sure that this layer does not affect the looping general animation of the model
    • as I have learned, you need to create a custom animation mask for that via code, which I did with this script:
      This worked fine, the mask contains all transforms
    • I applied this mask to the new animation layer and added the edited animation clip to a state
    • when entering playmode and triggering the animation, the clip plays back, but NO transform/rotation animation gets played back - the clip is working though, because i can see the active/inactive toggles of gameobjects, which is also animated in the clip
    What we tried:
    • Removing the layer mask: the clip plays back just fine then - so it contains valid animation(but I would really like to get the mask working)
    • Creating a custom avatar for the animated model as well (via code) and added it to the animator (no change)
    I don't get why it is not working. Can anyone help out here and give some guidance? Is it a bug?