Skip to main content

RigMap

A class in Root.Township, the global namespace.

Maps each BoneIdentifier in a required bone list to the matching transform in a character rig. Used, for example, to attach orbs to the player's body.

Constructors​

MemberWhat it is
RigMap()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

4 private and internal fields
MemberWhat it is
private List<Transform> bonesTransforms in the same order as the required list.
private bool btnFindInspector button that calls Find.
private Dictionary<BoneIdentifier, Transform> mapCached bone map.
private RigBoneList requiredListList of bones the rig must have.

Properties​

MemberWhat it is
Dictionary<BoneIdentifier, Transform> Bones { get; }Bone identifier to transform map, built on first use.

Methods​

MemberWhat it is
void Find()Editor: refills bones by finding each required bone by name under this transform.
Transform[] Map(BoneIdentifier[] boneIdentifiers)Returns the transforms for an array of bone identifiers, in the same order.
3 private and internal methods
MemberWhat it is
private void Awake()Builds the bone map.
private Dictionary<BoneIdentifier, Transform> GetBones()Builds the map from requiredList and bones the first time and returns it. Later changes to bones are not picked up.
private void OnValidate()Editor: re-runs Find when the bone count doesn't match the required list.

Used in​

Members of other types that take, return or hold a RigMap: