Game.Prefabs.NetGeometryInfomodePrefab
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ColorInfomodeBasePrefab
Summary:
Prefab class that configures an infomode for network geometry coloring. It exposes a NetType (the network category to visualize), provides a localized infomode type key ("NetworkColor"), declares the runtime ECS component required (InfoviewNetGeometryData) and initializes that component on the created Entity. The class is attributed with [ComponentMenu("Tools/Infomode/", ...)] so it is available in the Unity editor under Tools/Infomode.
Fields
public NetType m_Type
Holds the network type this infomode will visualize (e.g., road/rail/networks). NetType is an enum representing the network category. This value is copied into the InfoviewNetGeometryData component during Initialize.
Properties
public override string infomodeTypeLocaleKey => "NetworkColor"
Returns the localization key used to identify the infomode type in UI. This property is read-only and overrides the base implementation to indicate this prefab represents the "NetworkColor" infomode.
Constructors
public NetGeometryInfomodePrefab()
Default parameterless constructor (implicit in code). Instances are typically created/managed by Unity (as part of prefab/scriptable object lifecycle) rather than constructed manually in gameplay code.
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds the ECS component types required by this prefab to the provided set. Calls base.GetPrefabComponents(components) and then adds ComponentType.ReadWrite(), indicating that entities created from this prefab will need read/write access to InfoviewNetGeometryData. -
public override void Initialize(EntityManager entityManager, Entity entity)
Initializes the ECS entity for this prefab. Calls base.Initialize(entityManager, entity) and then sets the InfoviewNetGeometryData component on the entity with m_Type copied from the prefab: entityManager.SetComponentData(entity, new InfoviewNetGeometryData { m_Type = m_Type });
Usage Example
// Example showing how the prefab transfers its m_Type into the ECS component during initialization.
[Preserve]
public override void Initialize(EntityManager entityManager, Entity entity)
{
base.Initialize(entityManager, entity);
// ensure the entity has InfoviewNetGeometryData and set its m_Type to the prefab value
entityManager.SetComponentData(entity, new InfoviewNetGeometryData
{
m_Type = m_Type
});
}
{{ Additional notes: - This prefab is intended to be used by the infomode system to visualize network geometry coloring in the editor/game UI. - The InfoviewNetGeometryData component must be defined elsewhere; it contains at least an m_Type field matching NetType. - Because this class is a prefab type used by Unity, creation and lifecycle are typically handled by the game's prefab/asset system (e.g., ScriptableObject/prefab instantiation in the editor). }}