Rigs can't have the same name?

Hi there,

Not sure if this is a bug or not, since it isn’t mentioned in the documentation anywhere, but are you allowed to use the same name for game objects within the same rig?

The only difference between the following two screenshots is that rigs in the second have differing names.

The following script is attached to the tip of each limb to construct the overall rig at runtime:

using UnityEngine;
using UnityEngine.Animations.Rigging;

public class Limb : MonoBehaviour
    [SerializeField] private Transform rig;

    private void Awake()
        //Transform limb = new GameObject("Limb").transform; // Doesn't work...
        Transform limb = new GameObject("Limb_" + gameObject.GetInstanceID()).transform; // Works?
        limb.parent = rig;

        Transform target = new GameObject("Target").transform;
        target.parent = limb;

        TwoBoneIKConstraint tb = limb.gameObject.AddComponent<TwoBoneIKConstraint>();
        tb.data.tip = transform;
        tb.data.mid = transform.parent;
        tb.data.root = transform.parent.parent;
        tb.data.target = target;

The rig is then rebuilt using the following code snippet in a separate class:



Seeing your issue, I'm guessing your rig is imported as humanoid?

Bone names in a Humanoid character need to be unique. Because of this limitation, your animation rigging hierarchy must also have unique names.

Hi Simon, thanks for your response! The rig is actually imported as generic. Also, I just moved over to a test project to figure out what was happening, so the rig I'm actually working with is also generic (procedurally generated at runtime).

Sorry for the delay, I can’t be active on the forum as I once used to be.

Right, so I missed that in your example the first time you posted it, but the way you built your hierarchy will not work. The animation bindings are name based, so while you can have duplicate names in your hierarchy, your path however must be unique.

So this will work:


While this will not: