Skip to content

Game.Prefabs.MarkerInfomodePrefab

Assembly:
Assembly-CSharp

Namespace:
Game.Prefabs

Type:
class

Base:
InfomodeBasePrefab

Summary:
A prefab class used by the infomode tooling to represent a visual/info marker. Exposes a MarkerType (m_Type) that is written into the ECS component InfoviewMarkerData when the prefab is converted/initialized. The class ensures the InfoviewMarkerData component is declared as part of the prefab and that its m_Type field is initialized on the created entity. The class is annotated with Unity's ComponentMenu attribute so it appears under Tools/Infomode in the editor.


Fields

  • public MarkerType m_Type
    The marker type selected on the prefab (likely an enum). During initialization this value is copied into the InfoviewMarkerData component on the entity so runtime systems can react based on the marker's type. This field is intended to be configured in the Unity inspector.

Properties

  • This class does not declare any properties.

Constructors

  • public MarkerInfomodePrefab()
    Default public constructor inherited from MonoBehaviour/ScriptableObject base chain (no custom constructor logic in the class).

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Adds required ECS component types for this prefab to the provided set. Calls base.GetPrefabComponents(components) and then adds ComponentType.ReadWrite() so the resulting entity will include the InfoviewMarkerData component.

  • public override void Initialize(EntityManager entityManager, Entity entity)
    Called when the prefab is being converted/initialized into an Entity. Calls base.Initialize(entityManager, entity) and then sets the InfoviewMarkerData component data on the entity:

  • Sets m_Type in InfoviewMarkerData to the value of this prefab's m_Type field.

Notes: - Depends on the presence of the InfoviewMarkerData component type and the MarkerType type. - Intended to run in the context where an EntityManager and Entity are available (conversion or runtime prefab spawn).

Usage Example

// This example shows the effect of Initialize (the class already does this).
public class ExampleUsage
{
    public void ApplyPrefab(EntityManager em, Entity e, MarkerInfomodePrefab prefab)
    {
        // Premise: prefab.m_Type has been set in the inspector.
        prefab.Initialize(em, e);

        // After Initialize, the entity will have InfoviewMarkerData with m_Type == prefab.m_Type
        InfoviewMarkerData data = em.GetComponentData<InfoviewMarkerData>(e);
        Debug.Assert(data.m_Type == prefab.m_Type);
    }
}