Skip to main content

PlayerCosmeticDefinition

A class in Root.Township, Alta.Customization.

A purchasable cosmetic asset: its category, pickup and visual prefab.

Constructors​

MemberWhat it is
PlayerCosmeticDefinition()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

5 private and internal fields
MemberWhat it is
private CustomizationCategory categoryBacking field for Category. Its setter only works in the editor, and as written it throws even after setting a valid category.
private CustomizationPickup pickupPickup prefab used by SpawnPickup.
private CosmeticPickupType pickupTypeBacking field for PickupType.
private float uiSelectionBoardScaleBacking field for UISelectionBoardScale. Defaults to 1.
private CustomizationVisual visualPrefabVisual prefab returned by GetVisual and used for default arguments.

Properties​

MemberWhat it is
ICustomizationCategory Category { get; set; }The cosmetic's category. The setter only works in the editor, and as written it throws even after a valid set.
string Name { get; }The display name.
CosmeticPickupType PickupType { get; }What kind of pickup this cosmetic uses.
float UISelectionBoardScale { get; }Scale of the item on the customization selection board.

Methods​

MemberWhat it is
CustomizationArguments[] CreateDefaultArguments()Default customization arguments for each part of the visual.
ICustomizationVisual GetVisual()Points the visual prefab at this definition, initializes it and returns it.
CustomizationPickup SpawnPickup(CustomizationArguments[] arguments, Transform parent)Spawns the cosmetic's pickup with the given arguments under a parent.
override string ToString()Type, category and name, for logs.

Used in​

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