Skip to main content

PlayerCustomizationHandler

A class in Root.Township, Alta.Customization.

Links a player's character model to the customization system: finds bones by name, holds the armour and equipment managers and switches first person. A component on the player character.

Constructors​

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

Fields​

5 private and internal fields
MemberWhat it is
private PlayerArmorManager armorManagerBacking field for ArmorManager.
private Vector3 bodyBoundBoxSizeHalf extents of CharacterBounds.
private Dictionary<string, Transform> childMapBone name to transform under the character's root bone, used by GetBone.
private EditableEquipmentManager editableEquipmentManagerBacking field for EditableEquipmentManager.
private CharacterDummyPointer pointerPoints at the CharacterDummy this handler dresses.

Properties​

MemberWhat it is
PlayerArmorManager ArmorManager { get; }The player's armour manager.
Bounds CharacterBounds { get; }Bounds of the character body, from the inspector size.
CharacterDummy CharacterDummy { get; }The character model this handler drives.
EditableEquipmentManager EditableEquipmentManager { get; }The editable equipment manager.
bool HasManager { get; private set; }Whether a customization manager is set.
bool IsDestroyed { get; private set; }Set by Destroy.
bool IsFirstPerson { get; }Whether the model is in first person mode.
PlayerCharacterCustomizationManager Manager { get; private set; }The customization manager applying cosmetics to this character.
string Name { get; private set; }The game object's name, stored on Start.
Transform RootBone { get; }The model's root bone.

Events​

MemberWhat it is
event Action<PlayerCharacterCustomizationManager> onManagerUpdatedRaised when the manager changes.

Methods​

MemberWhat it is
void Destroy()Marks the handler destroyed and detaches it from its manager.
Transform GetBone(Transform oldBone, bool isLoggingUnfoundBones)Finds this character's bone with the same name (or entity original name) as another rig's bone. Can log misses.
void SetFirstPerson(bool isFirstPerson)Switches first person mode and tells the manager.
void SetManager(PlayerCharacterCustomizationManager manager)Sets the customization manager and raises onManagerUpdated.
4 private and internal methods
MemberWhat it is
private void AddToMap(Transform transform)Adds a transform and all its children to childMap by name, keeping the first of any duplicate name.
private void OnDrawGizmosSelected()Empty.
private void PrepareChildMap()Builds childMap from the root bone the first time a bone is looked up.
private void Start()Caches the object's name in Name.

Used in​

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