Search Unity

How should animator behave when multiple rigs are present?

Discussion in 'Animation' started by przemeknowaczyk, Oct 25, 2020.

  1. przemeknowaczyk

    przemeknowaczyk

    Joined:
    Mar 30, 2018
    Posts:
    6
    First of all, I'm not having a problem nor looking for help. I know what I'm gonna ask about is probably not intended way of using animator. I'm just curious why things work the way they work and would like to get some clarification from devs :3

    To the point: I have a prefab with given GameObjects structure:

    upload_2020-10-25_14-32-31.png

    - root object contains Animator script with attached AnimatorController and avatar comming from fbx file.
    - metarig is transforms tree imported with fbx file.
    - mesh contains script SkinnedMeshRenderer with attached mesh from fbx file and "root bone" property is set to one of the transforms from hierarchy under "metarig" gameObject.

    I'm launching game, object animates as it supposed to, everyhing works ok. I can preview played animation in Animation window and see all properties names are written with black font, which means they are on their places in hierarchy.

    Now, I'm chaning the prefab structure by adding one gameObject between root and it's children like this:

    upload_2020-10-25_14-41-19.png

    NewGameObject doesn't contains any scripts. When I select root object and open Animation window I can see that all animated properties are marked as missing and displayed in yellow font. However after launching game, animation still works as previously.

    Now, I'm making a final change: I'm duplicating NewGameObject like that:

    upload_2020-10-25_14-46-54.png

    From this point on, I can't achieve predictable behaviour. Result seems to vary between different fbx files. Sometimes only one mesh is animated, sometimes both, sometimes one mesh works perfect and the other one just spins randomly.

    Question for devs: how Unity should act in presented situation? How does the Animator decide what object is the root of the rig?