Skip to content

Game.Prefabs.CharacterOverlay

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: class

Base: PrefabBase

Summary:
Represents a prefab definition for a character overlay used by the game UI/system. This prefab exposes two public fields (m_Index and m_SortOrder) used to identify and order the overlay, and it registers a runtime ECS component (CharacterOverlayData) so the overlay data is available to the Entity Component System at runtime. Typically used by the prefab loading/registration pipeline to ensure entities created from this prefab receive the correct component.


Fields

  • public int m_Index
    Index identifier for this overlay prefab. Usually used to reference or look up a specific overlay instance (for example, different overlay variants for characters). Set and read by prefab configuration/loading code.

  • public int m_SortOrder
    Sorting/order value for the overlay. Determines rendering or processing order relative to other overlays (higher or lower values change the order depending on the system). Used by overlay managers or UI systems that respect a sort order.

Properties

  • This type defines no public properties.

Constructors

  • public CharacterOverlay()
    Implicit parameterless constructor (compiler-provided). Instances are typically created by the prefab system or by derived classes. No custom initialization is defined in the class source.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Adds required ECS component types for this prefab. Implementation calls the base method and then ensures the CharacterOverlayData ECS component is registered for read/write:

  • Calls base.GetPrefabComponents(components) to include base prefab components.

  • Adds ComponentType.ReadWrite<CharacterOverlayData>() to the provided set so that entities spawned from this prefab will include the CharacterOverlayData component.

This method is invoked by the prefab/entity creation pipeline to collect all component types that should be attached to entities created from this prefab.

Usage Example

// Example: simple usage showing how fields might be set and how the prefab
// registers its ECS component during the prefab pipeline.

var overlayPrefab = new Game.Prefabs.CharacterOverlay();
overlayPrefab.m_Index = 0;      // identifier for this overlay
overlayPrefab.m_SortOrder = 100; // ordering value used by overlay system

// When the prefab system collects component types, GetPrefabComponents will be called:
var components = new HashSet<Unity.Entities.ComponentType>();
overlayPrefab.GetPrefabComponents(components);

// components now contains ComponentType.ReadWrite<CharacterOverlayData>()
// which tells the ECS prefab/creation pipeline to attach CharacterOverlayData
// to any entity instantiated from this prefab.