Skip to content

Game.UITutorialGroupPrefab

Assembly: Game
Namespace: Game.Prefabs

Type: class

Base: UIGroupPrefab

Summary:
Prefab class used to declare the ECS components that a UI tutorial group requires. The class is marked with a ComponentMenu attribute so it appears in the UI prefab menu, and it ensures that the UITutorialGroupData component is included in the prefab's component set. This is used in the game's Entity Component System (Unity.Entities) prefab registration flow to make sure tutorial UI groups have the necessary data component at creation/instantiation time.


Fields

  • None
    This class does not declare any instance or static fields.

Properties

  • None
    No properties are declared on this class.

Constructors

  • public UITutorialGroupPrefab()
    Default public constructor (implicit if not defined). Typical prefab classes don't need special construction logic; initialization is usually handled by the base class or through prefab/component setup.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Overrides the base UIGroupPrefab implementation to add the UITutorialGroupData component type to the provided set. The method first calls base.GetPrefabComponents(components) to preserve the base class component list, then adds ComponentType.ReadWrite<UITutorialGroupData>() so instances of this prefab will include the tutorial data component in the ECS world.

Notes: - This method participates in prefab component collection/registration used by the Unity.Entities workflow. - The components HashSet will be used by the prefab system to determine which ECS components to attach to entities created from this prefab.

Usage Example

// The class itself already overrides GetPrefabComponents to add UITutorialGroupData.
// Example of how the override works (as implemented):

[ComponentMenu("UI/", new Type[] { })]
public class UITutorialGroupPrefab : UIGroupPrefab
{
    public override void GetPrefabComponents(HashSet<ComponentType> components)
    {
        // Keep base components (e.g., transform, UI group components)
        base.GetPrefabComponents(components);

        // Ensure this prefab has the tutorial data component in read/write mode
        components.Add(ComponentType.ReadWrite<UITutorialGroupData>());
    }
}

Additional info: - The class relies on Unity.Entities.ComponentType to declare component intent; ReadWrite means the component will be writable on entities created from this prefab. - The ComponentMenu attribute places this prefab type under the "UI/" menu in the editor tooling that discovers prefabs by attribute.