Skip to content

Game.Prefabs.UIStatisticsCategoryPrefab

Assembly:
Assembly-CSharp (typical; actual assembly depends on project build)

Namespace: Game.Prefabs

Type:
Class

Base:
UIGroupPrefab

Summary:
UIStatisticsCategoryPrefab is a prefab definition class used by the game's UI prefab system to represent a statistics category group in the UI. It participates in entity prefab composition by declaring which ECS components the prefab requires (notably UIStatisticsCategoryData). It also exposes a LateInitialize override point (currently only delegating to the base implementation), allowing additional runtime initialization of the created Entity if needed.


Fields

  • (This class declares no private or public fields.)
    This prefab class does not define any instance fields of its own.

Properties

  • (This class declares no properties.)
    No properties are defined on this prefab class.

Constructors

  • public UIStatisticsCategoryPrefab()
    The default constructor is the inherited parameterless constructor. No explicit construction logic is implemented in this class.

Methods

  • public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    This method collects the ECS component types required by the prefab. It calls the base implementation to include base group components, then adds:
  • UIStatisticsCategoryData (as ReadWrite) This ensures that when the prefab entity is created, it includes the UIStatisticsCategoryData component so systems can operate on it.

  • public override void LateInitialize(Unity.Entities.EntityManager entityManager, Unity.Entities.Entity entity)
    Called after the entity prefab has been created/initialized. The current implementation simply delegates to the base LateInitialize method and performs no additional initialization. This override exists to allow future or modder customization of runtime initialization for this specific prefab.

Usage Example

// Example: extending behavior by subclassing or using the prefab registration system.
// The prefab itself already adds the UIStatisticsCategoryData component when composed.

[ComponentMenu("UI/", new Type[] { })]
public class UIStatisticsCategoryPrefab : UIGroupPrefab
{
    public override void GetPrefabComponents(HashSet<ComponentType> components)
    {
        base.GetPrefabComponents(components);
        components.Add(ComponentType.ReadWrite<UIStatisticsCategoryData>());
    }

    public override void LateInitialize(EntityManager entityManager, Entity entity)
    {
        base.LateInitialize(entityManager, entity);
        // Custom initialization logic can be added here if needed:
        // e.g., set up default UIStatisticsCategoryData values on the entity.
    }
}

Notes and tips for modders: - UIStatisticsCategoryData is required for systems that render or manage statistics category UI elements; ensure any custom systems expect this component. - Use LateInitialize to modify component data on the created entity via the provided EntityManager if you need to set defaults or wire references after prefab creation. - The [ComponentMenu("UI/", ...)] attribute places the prefab in the UI menu in editor tooling — keep it if you want the prefab to appear in that menu.