Game.Prefabs.RouteConfigurationPrefab
Assembly:
Game (prefab assembly used by the game’s modding runtime)
Namespace:
Game.Prefabs
Type:
class
Base:
PrefabBase
Summary:
RouteConfigurationPrefab is a Prefab that groups references to various route visualization prefabs and the pathfinding notification prefab. It is marked with a ComponentMenu attribute ("Settings/") so it appears in the editor under settings. During initialization it writes a RouteConfigurationData component to the ECS entity, storing Entity references to each referenced prefab so runtime systems can use those visualizations and the notification icon.
Fields
-
public NotificationIconPrefab m_PathfindNotification
Reference to a NotificationIconPrefab used for pathfinding notifications. Added to dependencies so it will be converted to an Entity and stored in RouteConfigurationData. -
public RoutePrefab m_CarPathVisualization
Reference to the prefab used to visualize car routes. -
public RoutePrefab m_WatercraftPathVisualization
Reference to the prefab used to visualize watercraft routes. -
public RoutePrefab m_AircraftPathVisualization
Reference to the prefab used to visualize aircraft routes. -
public RoutePrefab m_TrainPathVisualization
Reference to the prefab used to visualize train routes. -
public RoutePrefab m_HumanPathVisualization
Reference to the prefab used to visualize human (pedestrian) routes. -
public RoutePrefab m_MissingRoutePrefab
Reference to a fallback prefab used when a route visualization is missing.
Properties
- None declared on this class. All data is exposed via public fields and converted to ECS data during LateInitialize.
Constructors
public RouteConfigurationPrefab()
No explicit constructor is defined in source; the class uses the default parameterless constructor inherited from object. Initialization logic is performed in the overridden lifecycle methods (GetDependencies, GetPrefabComponents, LateInitialize).
Methods
-
public override void GetDependencies(List<PrefabBase> prefabs)
Adds all referenced prefabs (m_PathfindNotification and all RoutePrefabs) to the provided dependency list so they will be processed/loaded with this prefab. Calls base.GetDependencies(prefabs) first. -
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds the RouteConfigurationData component type to the set of components that this prefab will provide on its entity. Calls base.GetPrefabComponents(components) first. -
public override void LateInitialize(EntityManager entityManager, Entity entity)
Called during prefab initialization to write a RouteConfigurationData component to the provided entity. Uses the PrefabSystem (obtained from entityManager.World.GetOrCreateSystemManaged()) to convert each referenced PrefabBase into an Entity and sets those Entity references into the RouteConfigurationData instance that is written to the entity.
Usage Example
// Example: reading the configured entities at runtime after prefab initialization.
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity routeConfigEntity = /* obtain the entity for the RouteConfigurationPrefab */;
if (em.HasComponent<RouteConfigurationData>(routeConfigEntity))
{
RouteConfigurationData cfg = em.GetComponentData<RouteConfigurationData>(routeConfigEntity);
// cfg.m_CarPathVisualization, cfg.m_PathfindNotification, etc. are Entity references
// that can be used by route visualization systems.
}