Skip to main content

CosmeticPickup

A class in Root.Township, Alta.Customization.

Grabbable preview of a cosmetic in the customization room. Builds a small coloured model from the item's mesh parts when spawned. Client side.

Constructors​

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

Fields​

9 private and internal fields
MemberWhat it is
private Material baseMaterialMaterial copied for each mesh in the preview.
private Bounds boundsCombined bounds of the preview meshes, used to centre them.
private static readonly int bumpMapShader property ID for _BumpMap.
private readonly List<Material> createdMaterialsMaterials made by CreateMaterial, cleaned up on disable.
private static readonly int dstBlendShader property ID for _DstBlend.
private static readonly int mainTexShader property ID for _MainTex.
private Vector3 maxBoundsSerialized maximum preview size. Not read in this file.
private static readonly int srcBlendShader property ID for _SrcBlend.
private static readonly int zWriteShader property ID for _ZWrite.

Methods​

MemberWhat it is
override CustomizationPickup Spawn(ICustomizationDefinition definition, CustomizationArguments[] arguments, Transform parent)Spawns the pickup through the base class, then runs Setup on the new copy.
3 private and internal methods
MemberWhat it is
private Material CreateMaterial(ICosmeticMeshPartBase meshPart, int argumentIndex)Makes a material from baseMaterial with the part's colours, texture and normal map, set up for alpha blending if the part needs it.
private void OnDisable()Destroys the materials this pickup created.
private void Setup()Builds child mesh objects from LOD 0 of each mesh part, then centres and scales them by the category's pickup scale.