Skip to main content

CosmeticMeshPartBase<T>

A class in Root.Township, Alta.Customization.

A cosmetic part that adds a mesh with its own texture to the character, coloured with two cosmetic colours. Attaching it adds an input to the character's cosmetic packer and repacks.

Constructors​

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

Fields​

17 private and internal fields
MemberWhat it is
private Mesh[] androidImpededLodsAndroid LOD meshes used when the part is impeded (covered by another item). Serialized but the packer reads impededLods.
private Mesh[] androidLodsAndroid LOD meshes. Serialized but the packer reads lods.
private Texture2D androidNormalAndroid normal map. Serialized but not used by the getters.
private Texture2D androidTextureAndroid diffuse texture. Serialized but not used by the getters.
private CustomizationVisualPart copyColorFromAnother part whose colours this part shares; colour changes are passed on to it and the packer copies from its input.
private Mesh[] impededLodsLOD meshes used when the part's arguments are marked impeded (for example hair under a hat).
private bool isAlphaBlendingWhether the part is packed into the transparent meshes and drawn alpha blended.
private bool isAlphaBlendingAndroidAndroid version of isAlphaBlending. Serialized but not read.
private bool isColorLockedWhen set, ApplyColorToArguments refuses to recolour this part.
private bool isDisabledOnAndroidSerialized flag to skip the part on Android, but IsDisabledOnAndroid always returns false in this build.
private bool isGeneratingBackFacesWhen set, the mesh packer adds reversed triangles so the part shows from both sides.
private bool isShownInFirstPersonWhen false the part is packed into the head meshes, which are hidden in first person.
private Mesh[] lodsLOD meshes for this part, highest detail first.
private static Logger loggerNLog logger for this class.
private Texture2D normalNormal map packed into the character's normal atlas.
private EditorLink originalLinkEditor link back to the source asset.
private Texture2D textureDiffuse texture packed into the character's atlas.

Properties​

MemberWhat it is
ICosmeticMeshPartBase CopyColorFrom { get; }Another part whose colours this part shares, if any.
Mesh[] ImpededLods { get; }LOD meshes used instead when the part's arguments are marked impeded. If empty, the part is skipped then.
bool IsAlphaBlending { get; }Whether the part uses alpha blending.
bool IsDisabledOnAndroid { get; }Always false in this build, whatever the inspector says.
bool IsGeneratingBackFaces { get; }Whether back faces are generated for the mesh.
virtual bool IsTextureSharingForced { get; }Whether the packer must share this part's texture. False in the base class.
Mesh[] Lods { get; }The part's LOD meshes.
Texture2D Normal { get; }The part's normal map.
Texture2D Texture { get; }The part's diffuse texture.
int WorkingIndex { get; set; }Index the packer uses while working on this part.

Methods​

MemberWhat it is
bool ApplyColorToArguments(CosmeticColor color, bool isPrimary, CustomizationArguments[] arguments)Sets the primary or secondary colour on this part and the part it copies from. False if locked or unchanged.
virtual void GetCustomPickupColors(out CosmeticColor primary, out CosmeticColor secondary)Colours to use when the part is shown as a pickup. Null in the base class.
protected override void Attach(ICustomizationHandler handler, CustomizationArguments arguments)Adds this part to the character's cosmetic packer and repacks. Logs an error if it is already there.
protected override void ChangeArguments(ICustomizationHandler handler, CustomizationArguments arguments)Updates the part's colours in the packer and repacks.
protected virtual CosmeticPacker.Input CreateInput(ICustomizationHandler handler, CustomizationArguments arguments)Builds the packer input: part id, colours, first-person visibility, blending and blit materials.
protected override void Detach(ICustomizationHandler handler)Removes this part from the packer, cleans its materials and repacks.
1 private and internal method
MemberWhat it is
private void OnValidate()Editor hook; empty in this build.