Game.Prefabs.ParkingLane
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: public class
Base: ComponentBase
Summary:
Represents a parking-lane prefab component used by the net/prefab system to define parking slots on a road lane. This component exposes editable parameters (road type, slot size, slot angle and special-vehicle flag) and participates in prefab-to-entity conversion by declaring which ECS components are required for the resulting entity/archetype (e.g., ParkingLaneData and the runtime Game.Net.ParkingLane). Use this component when authoring or modding road/lanes to provide parking functionality for vehicles.
Fields
-
public RoadTypes m_RoadType = RoadTypes.Car
Specifies the traffic type associated with the parking lane (for example Car, Bus, etc.). Defaults to RoadTypes.Car. The exact enum values are defined in the project (RoadTypes). -
public float2 m_SlotSize
Size of an individual parking slot. Uses Unity.Mathematics.float2 (typically width, length). This determines how parking spaces are laid out along the lane. -
public float m_SlotAngle
Angle of the parking slots relative to the lane direction. Used to orient individual parking spaces (e.g., perpendicular, angled). Interpreted by the parking layout logic when generating slot positions. -
public bool m_SpecialVehicles
If true, the parking lane is marked for special vehicles (for example enabling parking for service or emergency vehicles according to game logic).
Properties
- None declared on this component. The component exposes its configuration via public fields and declares required ECS components via GetPrefabComponents / GetArchetypeComponents.
Constructors
public ParkingLane()
(implicit)
No explicit constructor is defined; the default parameterless constructor is provided by the runtime.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds component types required on the prefab representation. Implementation adds:-
ComponentType.ReadWrite
()
This tells the conversion system that the prefab will produce/require a ParkingLaneData component on the entity. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Adds component types required on the entity archetype created for this lane. Implementation adds: - ComponentType.ReadWrite
() — runtime parking lane data used by net systems - ComponentType.ReadWrite
() — marks the entity as a lane object - ComponentType.ReadWrite
() — used for overlap detection/resolution between lanes
These entries guide the ECS archetype creation so that entities representing this parking lane include the proper runtime components.
Usage Example
// Example: configure a ParkingLane on a prefab (typically done in editor or prefab initialization)
var parking = new ParkingLane();
parking.m_RoadType = RoadTypes.Car;
parking.m_SlotSize = new float2(2.5f, 5.0f); // width x length (units according to game scale)
parking.m_SlotAngle = 90f; // slot oriented perpendicular to lane
parking.m_SpecialVehicles = false;
// During prefab conversion the system will call:
// parking.GetPrefabComponents(prefabComponents);
// parking.GetArchetypeComponents(archetypeComponents);
Notes and tips for modders: - The public fields are intended to be set in the prefab inspector when authoring net prefabs. Modifying them at runtime will not automatically update generated ECS data unless you handle prefab regeneration or conversion. - The component registers ParkingLaneData and runtime Game.Net.ParkingLane so ensure you understand how those data types are consumed by the net/parking systems before changing archetype composition. - Consult existing road/parking prefabs in the base game for slot sizing, typical angles (perpendicular vs. angled parking) and how special-vehicle parking behaves.