Skip to content

Game.Prefabs.InfomodeGroupPrefab

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs

Type: class

Base: InfomodePrefab

Summary:
InfomodeGroupPrefab is a small prefab helper class used by the game's prefab system to declare that a prefab should include the InfomodeGroup ECS component. It extends InfomodePrefab and overrides GetPrefabComponents to add ComponentType.ReadWrite() to the set of components for the prefab. The class is annotated with Unity's ComponentMenu attribute so it appears under the "Tools/" menu in the Unity editor.


Fields

  • (none)
    This class declares no explicit instance fields.

Properties

  • (none)
    This class declares no properties.

Constructors

  • public InfomodeGroupPrefab()
    Default public constructor is used by Unity when creating the component on a GameObject. No special initialization is performed by this class.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    This override extends the base InfomodePrefab behavior by adding the InfomodeGroup component to the provided HashSet of ComponentType objects. Implementation detail:
  • Calls base.GetPrefabComponents(components) to allow the base class to add its components.
  • Adds ComponentType.ReadWrite<InfomodeGroup>() to the components set, marking the prefab as requiring the InfomodeGroup ECS component with read/write access.

Notes: - The method parameter is a HashSet that the prefab system uses to collect all ECS components that should be present on entities spawned from this prefab. - InfomodeGroup is expected to be an ECS component type defined elsewhere in the codebase.

Usage Example

using System.Collections.Generic;
using Unity.Entities;
using Game.Prefabs;

// Unity will create an instance of this component on a GameObject / prefab.
// The prefab system will call GetPrefabComponents to gather required ECS components.
public class Example
{
    void RegisterPrefab(InfomodeGroupPrefab prefab)
    {
        var components = new HashSet<ComponentType>();
        prefab.GetPrefabComponents(components);

        // components now contains ComponentType.ReadWrite<InfomodeGroup>()
        // and any components added by the base InfomodePrefab.
    }
}

Additional implementation notes: - The class is decorated with [ComponentMenu("Tools/", new Type[] { })], which places it in the Unity Component menu under "Tools/" for authoring in the editor. - Use this prefab component when you want entities created from a prefab to include the InfomodeGroup ECS component so systems operating on InfomodeGroup can process them.