Game.Prefabs.PedestrianLane
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
Represents a pedestrian lane prefab component used by the game's net (road/paths) system. This component exposes simple configuration (width and whether the lane is on water) and participates in converting the prefab into ECS entity components by adding the appropriate ComponentType entries for both prefab and archetype. It is annotated with a ComponentMenu entry so it appears under the "Net/" category in the Unity Add Component menu and is associated with NetLanePrefab tooling.
Fields
-
public float m_Width
Specifies the width of the pedestrian lane in world units. Used by net-generation and placement logic to size the lane and its collision/visual representation. Default value is the language/runtime default for float (0.0) unless set on the prefab. -
public bool m_OnWater
Flag indicating whether this pedestrian lane is intended to be situated over water (for example, on boardwalks or piers). This can affect how the lane is treated by placement/validation and by systems that distinguish water-based net elements.
Properties
- This class does not declare public properties. Configuration is exposed via the public fields above and by the component-to-entity mapping methods.
Constructors
public PedestrianLane()
Default constructor provided by Unity when adding the component to a GameObject/prefab. Typical initialization of this component is done by setting public fields in the editor or via code; no custom constructor logic is present in the source.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds component types that should be present on the prefab entity. Implementation adds:-
ComponentType.ReadWrite
()
This ensures the prefab will carry the PedestrianLaneData component on its converted entity, which typically contains serialized configuration data needed at runtime. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Adds component types to the archetype used when instantiating runtime entities from this prefab. Implementation adds: - ComponentType.ReadWrite
() — the runtime ECS component representing the pedestrian lane. - ComponentType.ReadWrite
() — links lane entity to its lane object representation. - ComponentType.ReadWrite
() — indicates overlap handling data for lanes.
These methods are used by the prefab-to-entity conversion pipeline to ensure the right ECS components are present on created entities. ComponentType.ReadWrite
Usage Example
// Example: create/configure a pedestrian lane component on a prefab in code
var go = new GameObject("PedestrianLanePrefab");
var lane = go.AddComponent<Game.Prefabs.PedestrianLane>();
lane.m_Width = 1.8f;
lane.m_OnWater = false;
// When the prefab is converted to an ECS entity, GetPrefabComponents() and
// GetArchetypeComponents() will ensure the corresponding ECS components are added:
// - PedestrianLaneData on the prefab entity
// - Game.Net.PedestrianLane, LaneObject, LaneOverlap on the archetype / runtime entity
Notes: - The class is decorated with: [ComponentMenu("Net/", new Type[] { typeof(NetLanePrefab) })] which places the component under the "Net/" menu and associates it with the NetLanePrefab tooling/context in the editor. - This component is intended to be used on net/road/path prefabs and participates in the game's entity conversion and lane management systems.