Advanced People Pack 2.8 API Overview

public class CharacterCustomization

Switch character settings by selector index Example

public void SwitchCharacterSettings(int settingsIndex);

Init character by settings

  • newSettings – New character settings to load
  • public void InitializeMeshes(CharacterSettings newSettings = null);

    Update bounds all character meshes

    public void UpdateSkinnedMeshesOffscreenBounds()

    Get all character selectors Example

    public List<CharacterSettingsSelector> GetCharacterSettingsSelectors()

    Reset body colors to default values Example

    public void ResetBodyColors()

    Reset body material from all character parts to default

    public void ResetBodyMaterial()

    Initialize body colors

    public void InitColors()

    Set body shape (blend shapes) Example

  • type– Body type
  • weight– Weight (0 to 100)
  • forPart– Apply to specific body parts
  • forClothPart– Apply to specific cloth parts
  • public void SetBlendshapeValue(CharacterBlendShapeType type, float weight, string[] forPart = null, CharacterElementType[] forClothPart = null)

    Change LOD level

  • lodLevel– LOD level (0-3). Value < 0 return to standard LOD processing.
  • public void ForceLOD(int lodLevel)

    Set character element Example

  • type– Type of clothes
  • index– Index of element
  • public void SetElementByIndex(CharacterElementType type, int index)

    Clear character element

  • type– Element type
  • public void ClearElement(CharacterElementType type)

    Set character height Example

    public void SetHeight(float height)

    Set character head size Example

    public void SetHeadSize(float size)

    Set character feet offset. Usually used for tall shoes.

    public void SetFeetOffset(Vector3 offset)

    Get clothes anchor(the mesh to which the clothes are attached) by type

  • type– Cloth type
  • public ClothesAnchor GetClothesAnchor(CharacterElementType type)

    Get character part by name

  • name– Part name
  • public CharacterPart GetCharacterPart(string name)

    Get all character meshes by LOD level

  • index– LOD index
  • public List<SkinnedMeshRenderer> GetAllMeshesByLod(int lod)

    Get all character meshes

    public List<SkinnedMeshRenderer> GetAllMeshes()

    Hide character parts

  • parts– Array of parts to hide
  • public void HideParts(string[] parts)

    UnHide character parts

  • parts– Array of parts to unhide
  • hidePartsForElement– Hide parts for this cloth type
  • public void UnHideParts(string[] parts, CharacterElementType hidePartsForElement)

    Set body color by type Example

  • bodyColorPart– Body part to change color
  • color– New color
  • public void SetBodyColor(BodyColorPart bodyColorPart, Color color)

    Get the used color of a specific part of the body

  • bodyColorPart– Body part
  • public Color GetBodyColor(BodyColorPart bodyColorPart)

    Set character setup, use setup class

    public void SetCharacterSetup(CharacterCustomizationSetup characterCustomizationSetup)

    Generate setup class from current character

    public CharacterCustomizationSetup GetSetup()

    Apply saved data to current character

    public void ApplySavedCharacterData(SavedCharacterData data)

    Load character from file

    public void LoadCharacterFromFile(string path)

    Gets a list of character saves from the directory

    public List<SavedCharacterData> GetSavedCharacterDatas(string path = "")

    Delete all character saves from default directory

    public void ClearSavedData()

    Save character to file

  • format– Save format
  • path– Directory
  • name– File name
  • public void SaveCharacterToFile(CharacterCustomizationSetup.CharacterFileSaveFormat format, string path = "", string name = "")

    Recalculate all blendshapes

    public void RecalculateShapes()

    Combine all character parts to single mesh (include all LODs) Example

    public void BakeCharacter(bool usePreBuiltMeshes = false)

    Clear all combine meshes, and enable customizable mode

    public void ClearBake()

    Recalculate LODs

    public void RecalculateLOD()

    Change the number of LODs

  • minLod– Lower LOD
  • maxLod– Higher LOD
  • public void SetLODRange(int minLod, int maxLod)

    Get combined state

    public bool IsBaked()

    Get element preset

  • type– Preset type
  • index– Preset index
  • public CharacterElementsPreset GetElementsPreset(CharacterElementType type, int index)

    Get all element presets by type

    public List<CharacterElementsPreset> GetElementsPresets(CharacterElementType type)

    Play animation Example

  • animationName– Animation name
  • duration– Animation duration
  • weightPower– Animation power
  • public void PlayBlendshapeAnimation(string animationName, float duration = 1f, float weightPower = 1f)

    Stop any emotion

    public void StopBlendshapeAnimations()

    Reset all character changes

  • ignore_settingsDefaultElements – Ignore default element from settings
  • public void ResetAll(bool ignore_settingsDefaultElements = true)

    Randomize character customization Example

    public void Randomize()

    Get character animator

    public Animator GetAnimator()

    Powered by BetterDocs