Skip to content

Game.Prefabs.RouteInfomodePrefab

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: public class RouteInfomodePrefab

Base: InfomodeBasePrefab

Summary:
Prefab component used by the infomode system to represent a "route" information mode (network color view) for a specific route type. It exposes a RouteType field that is written into an ECS component (InfoviewRouteData) when the prefab is converted/initialized into an Entity. This prefab ensures the entity has the InfoviewRouteData component and sets its m_Type field to the prefab's configured route type. It integrates Unity.Entities (ECS) with the infomode/prefab workflow.


Fields

  • public Game.Routes.RouteType m_Type
    Holds the route type (enum defined in Game.Routes) that this infomode prefab represents. This value is copied into the InfoviewRouteData component on the entity during Initialize. Configure this in the inspector or via script to control which route type this infomode displays.

Properties

  • public override string infomodeTypeLocaleKey { get; }
    Returns the localization key used for this infomode's display name in UI. For this prefab the property returns the fixed string "NetworkColor". This key can be used by the UI/localization system to look up a localized label for the infomode.

Constructors

  • public RouteInfomodePrefab()
    Default public constructor (implicit if not defined). Typical Unity use creates and configures this component via the inspector or prefab system rather than constructing it manually.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Adds required ECS component types to the provided set so the prefab-to-entity conversion knows which components to create on the resulting Entity. Implementation:
  • Calls base.GetPrefabComponents(components).
  • Adds ComponentType.ReadWrite() to ensure the InfoviewRouteData component is present and writable on the entity.

  • public override void Initialize(Unity.Entities.EntityManager entityManager, Unity.Entities.Entity entity)
    Called during prefab-to-entity conversion/initialization. Implementation:

  • Calls base.Initialize(entityManager, entity).
  • Writes an InfoviewRouteData struct to the entity via entityManager.SetComponentData, setting its m_Type field to this prefab's m_Type value. This links the prefab-configured route type to the runtime ECS component used by infomode systems.

Usage Example

// Example: Configure the prefab component in a MonoBehaviour or editor script
var prefabComponent = gameObject.GetComponent<Game.Prefabs.RouteInfomodePrefab>();
// Set the route type (for example, to Bus). Replace with an actual RouteType value.
prefabComponent.m_Type = Game.Routes.RouteType.Bus;

// When the prefab is converted to an Entity (by the conversion workflow),
// GetPrefabComponents will ensure InfoviewRouteData is added and
// Initialize(...) will write an InfoviewRouteData with m_Type = Bus to the Entity.

{{ Additional notes: - This prefab relies on the ECS type InfoviewRouteData (struct) being defined elsewhere; that struct must contain a field m_Type compatible with Game.Routes.RouteType. - The RouteType enum is defined in Game.Routes; use its members to configure m_Type. - This component is typically used by the editor/prefab conversion pipeline rather than created at runtime via new. }}