Game.Prefabs.CharacterGroup
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: RenderPrefabBase
Summary:
CharacterGroup is a renderable prefab container used to define a set of character variants for the game. It groups together character styles, mesh prefabs and optional override groups that can be conditionally applied (for example depending on object state). This prefab is used by the rendering/character spawning systems to collect required assets and to declare which ECS components its instances will need.
Nested types
public class Character
Holds data for a single character variant:public CharacterStyle m_Style
— reference to the character style (appearance definitions).public Meta m_Meta
— procedural weight data for shapes/textures/overlays/masks.-
public RenderPrefab[] m_MeshPrefabs
— array of mesh/render prefabs used for this character. -
public class OverrideInfo
Describes an override that references another CharacterGroup and when to apply it: public CharacterGroup m_Group
— other group to use as override.public ObjectState m_RequireState
— required object state to enable this override.public CharacterProperties.BodyPart m_OverrideBodyParts
— which body parts to override.-
public bool m_OverrideShapeWeights
— whether to override shape weights. -
public struct IndexWeight
Lightweight pair: public int index
-
public float weight
-
public struct IndexWeight8
Holds up to eight IndexWeight entries (w0..w7) for packing multiple weights. -
public struct Meta
Groups weight sets used by a Character: public IndexWeight8 shapeWeights
public IndexWeight8 textureWeights
public IndexWeight8 overlayWeights
public IndexWeight8 maskWeights
Fields
-
public Character[] m_Characters
Collection of character variants defined by this group. Each entry references a CharacterStyle, metadata (weights) and mesh prefabs required to render that character. -
public OverrideInfo[] m_Overrides
Optional array of overrides. Each entry points to another CharacterGroup and the conditions/body parts under which that group should replace or modify this group's data.
Properties
- (none)
Constructors
public CharacterGroup()
Default parameterless constructor (compiler-provided). Instances are typically created/managed by the prefab system rather than manually instantiated at runtime.
Methods
public override void GetDependencies(System.Collections.Generic.List<PrefabBase> prefabs)
Collects and adds all PrefabBase dependencies used by this CharacterGroup into the provided list. Implementation details:- Calls base.GetDependencies(prefabs).
- Iterates over m_Characters:
- Adds each character's m_Style to prefabs.
- Adds every RenderPrefab referenced in character.m_MeshPrefabs to prefabs.
-
If m_Overrides is not null, iterates overrides and adds overrideInfo.m_Group to the list. This method is used by the prefab loading system to build a complete dependency list so that required prefabs are loaded/available.
-
public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
Adds the ECS component types required by instances of this prefab to the supplied set. Implementation details: - Calls base.GetPrefabComponents(components).
- Adds ComponentType.ReadWrite
() to indicate that prefab instances will use the CharacterGroupData component (read/write access). This is used by the conversion/prefab->entity logic to ensure correct components are created for entities spawned from this prefab.
Usage Example
// Example: gather dependencies for a CharacterGroup instance
var prefs = new List<PrefabBase>();
CharacterGroup group = /* obtain reference from prefab manager */;
group.GetDependencies(prefs);
// Example: collect needed ECS components for prefab conversion
var components = new HashSet<Unity.Entities.ComponentType>();
group.GetPrefabComponents(components);