Skip to content

Game.Prefabs.ObjectStateInfomodePrefab

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

Type: class

Base: ColorInfomodeBasePrefab

Summary:
Prefab component used to configure an "object status" infomode for an entity. This prefab adds and initializes the InfoviewObjectStatusData component on the ECS entity so the infomode system knows which ObjectStatusType to display for that entity. The class is exposed in the Unity editor menu via the ComponentMenu attribute under "Tools/Infomode/".


Fields

  • public ObjectStatusType m_Type
    The object status type that this infomode prefab will apply to the entity. When the prefab is initialized the value of m_Type is stored into the InfoviewObjectStatusData component on the entity so the infoview/infomode rendering can use it.

Properties

  • This class declares no public properties.

Constructors

  • public ObjectStateInfomodePrefab()
    Default parameterless constructor (implicit). Typical usage is via Unity/engine instantiation of the prefab class; no special construction logic is defined.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Calls the base implementation and then ensures the InfoviewObjectStatusData component type is included in the set of components that should be present on the prefab entity. Specifically it adds ComponentType.ReadWrite() so the entity will have a writable InfoviewObjectStatusData component.

  • public override void Initialize(EntityManager entityManager, Entity entity)
    Initializes the ECS entity by calling the base.Initialize and then setting the InfoviewObjectStatusData component on the entity with the current m_Type value: entityManager.SetComponentData(entity, new InfoviewObjectStatusData { m_Type = m_Type });

Usage Example

// The prefab class already implements Initialize to set the InfoviewObjectStatusData.
// Example showing what happens during initialization (simplified):

public class ExampleUsage
{
    public void ApplyPrefab(EntityManager entityManager, Entity prefabEntity, ObjectStateInfomodePrefab prefab)
    {
        // Create an entity from a prefab (this is illustrative; actual prefab instantiation
        // is handled by the game's prefab system)
        Entity instance = entityManager.Instantiate(prefabEntity);

        // Initialize the instance with the prefab data (the prefab's Initialize does the SetComponentData)
        prefab.Initialize(entityManager, instance);

        // After this, the entity will have InfoviewObjectStatusData with m_Type equal to prefab.m_Type
    }
}

Notes: - Requires the Unity.Entities types (EntityManager, Entity, ComponentType). - Depends on InfoviewObjectStatusData and ObjectStatusType definitions being available in the project.