Game.LivePathPrefab
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: RoutePrefab
Summary:
LivePathPrefab is a prefab class used by the routing system to ensure route-related entities receive the appropriate components at archetype creation. It is annotated with ComponentMenu("Routes/") so it appears under the Routes menu in the editor. The prefab delegates most behavior to its RoutePrefab base class and conditionally adds LivePath and related source components based on which route-related components are present on the target entity archetype.
Fields
- This class declares no fields.
{{ Contains only overrides of virtual methods from the base prefab. }}
Properties
- This class declares no properties.
{{ It does not expose additional properties; behavior is implemented via overridden methods. }}
Constructors
public LivePathPrefab()
{{ No explicit constructor is defined in the source — the default parameterless constructor is used. Initialization (if any) occurs in base classes or via overridden methods. }}
Methods
-
public override void GetDependencies(List<PrefabBase> prefabs)
{{ Calls base.GetDependencies(prefabs). This class currently does not add extra prefab dependencies but preserves the hook for future extension. Parameter: prefabs — a list to which required prefab references can be added. }} -
public override void GetPrefabComponents(HashSet<ComponentType> components)
{{ Calls base.GetPrefabComponents(components). No additional prefab components are added here; the method is available to augment the prefab component set if needed in the future. Parameter: components — a set of ComponentType entries that the prefab requires. }} -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
{{ Extends the base implementation and conditionally adds components to the archetype component set: - If the archetype already contains ComponentType.ReadWrite
(), it adds ComponentType.ReadWrite (). - Else, if it contains ComponentType.ReadWrite
(), it adds ComponentType.ReadWrite (). - Else, if it contains ComponentType.ReadWrite
(), it adds ComponentType.ReadWrite (), ComponentType.ReadWrite (), and ComponentType.ReadWrite (). This method therefore ensures route entities have the LivePath component and, for segment-based archetypes, the PathSource and CurveSource components required for path/curve data. Parameter: components — the set of components composing the new entity archetype. }}
Usage Example
// Example: ensure an archetype with Segment gets live-path related components
var prefab = new LivePathPrefab();
var components = new HashSet<ComponentType>();
// Simulate an archetype that already contains Segment
components.Add(ComponentType.ReadWrite<Segment>());
// Populate archetype components via the prefab
prefab.GetArchetypeComponents(components);
// After the call, components will include:
// - ComponentType.ReadWrite<LivePath>()
// - ComponentType.ReadWrite<PathSource>()
// - ComponentType.ReadWrite<CurveSource>()
{{ Notes: This prefab is part of the routing/prefab system. It relies on Unity.Entities.ComponentType and the project's Route/Waypoint/Segment types (Game.Routes). When modifying or extending, preserve the call to base.* to maintain base-class behavior. }}