Game.Prefabs.SecondaryLane
Assembly:
Unknown (likely the main Game assembly or a Prefabs assembly)
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
Represents a secondary-lane prefab definition used by the road (Net) system. This component holds references to lane prefabs that should be created to the left/right of a primary lane, crossing lanes, and a set of placement and collision/spacing parameters used by the road building/placement logic. It supplies dependency information (prefab references) and the ECS component types required at runtime.
Fields
-
public SecondaryLaneInfo[] m_LeftLanes
Array of lane prefab descriptors that should be placed to the left side of the main lane. Each element is expected to contain a reference to a lane prefab (m_Lane). Can be null or empty. -
public SecondaryLaneInfo[] m_RightLanes
Array of lane prefab descriptors for the right side of the main lane. Used similarly to m_LeftLanes. -
public SecondaryLaneInfo2[] m_CrossingLanes
Array of lane descriptors used for crossing lanes (e.g., pedestrian crossings or lane connections across the main lane). Each element contains a lane reference (m_Lane). -
public bool m_CanFlipSides
If true, the lane placement logic may flip left/right lanes (useful for mirrored road variants or supporting LTR/RTL layouts). -
public bool m_DuplicateSides
If true, the same side lane set may be duplicated on both sides (or otherwise used to produce symmetric placements). -
public bool m_RequireParallel
If true, requires parallel lanes/placement; used by placement/validation logic. -
public bool m_RequireOpposite
If true, requires opposite-direction lanes to exist or be placed; used by placement rules. -
public bool m_SkipSafePedestrianOverlap
If true, skip overlap checks for "safe" pedestrian interactions (may allow closer placement to pedestrian elements). -
public bool m_SkipSafeCarOverlap
If true, skip overlap checks for safe car overlaps. -
public bool m_SkipUnsafeCarOverlap
If true, skip overlap checks for unsafe car overlaps. -
public bool m_SkipTrackOverlap
If true, skip overlap checks with track elements (trams/rail). -
public bool m_SkipMergeOverlap
If true, skip overlap checks related to merge areas. -
public bool m_FitToParkingSpaces
If true, lane placement will try to account for parking-space geometry when fitting secondary lanes. -
public bool m_EvenSpacing
If true, enforce even spacing between repeated/duplicated lanes. -
public float3 m_PositionOffset
Offset applied to the placed lane prefabs in 3D space (Unity.Mathematics.float3). -
public float2 m_LengthOffset
Length offset (start/end) applied to the lane placement (Unity.Mathematics.float2). -
public float m_CutMargin
Margin used when trimming/cutting lanes during placement. -
public float m_CutOffset
Offset used when cutting lane geometry. -
public float m_CutOverlap
Overlap amount allowed when cutting/merging lane geometry. -
public float m_Spacing
Default spacing between lanes when placing multiple secondary lanes.
Properties
- (no public properties declared)
Constructors
public SecondaryLane()
Default parameterless constructor inherited from ComponentBase. The component fields are expected to be initialized by the prefab data (in editor or prefab loader).
Methods
public override void GetDependencies(List<PrefabBase> prefabs)
Adds referenced lane prefabs (m_Lane from each entry in m_LeftLanes, m_RightLanes and m_CrossingLanes) to the provided prefabs list. This ensures those lane prefabs are loaded/available when this prefab is used.
Behavior notes: - Safely checks for null arrays before iterating. - For each SecondaryLaneInfo / SecondaryLaneInfo2 entry, it adds the referenced m_Lane to the list; modders should ensure m_Lane references are valid PrefabBase-derived objects.
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds the prefab-level component type required by this prefab data:- ComponentType.ReadWrite
()
This declares that entities created from this prefab will include the SecondaryLaneData component at prefab/authoring time.
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Adds the runtime archetype component type required in the entity archetype:- ComponentType.ReadWrite
()
This ensures the runtime ECS archetype for entities using this prefab includes the Game.Net.SecondaryLane component.
Usage Example
// Example: customizing a SecondaryLane instance in a prefab authoring script
var secLane = prefab.GetComponent<SecondaryLane>();
// Assign a single left lane prefab (assumes LanePrefab is a PrefabBase reference)
secLane.m_LeftLanes = new[] { new SecondaryLaneInfo { m_Lane = LanePrefab } };
// Ensure spacing and offsets are set to desired values
secLane.m_Spacing = 1.75f;
secLane.m_PositionOffset = new float3(0, 0, 0.5f);
secLane.m_CanFlipSides = true;
Additional notes for modders: - The class is a pure authoring/prefab component (not a runtime behaviour). Its job is to inform the prefab system and the Net-building logic which extra lanes to spawn and how to place them. - The referenced helper types (SecondaryLaneInfo, SecondaryLaneInfo2, SecondaryLaneData, and Game.Net.SecondaryLane) are defined elsewhere; ensure compatibility when creating or patching prefabs. - When adding new lane prefabs, make sure GetDependencies includes them so they are packed/loaded together with the main net prefab to avoid missing references at runtime.