Game.Prefabs.NetCompositionLane
Assembly: Assembly-CSharp (in-game; actual assembly name may vary)
Namespace: Game.Prefabs
Type: struct
Base: Unity.Entities.IBufferElementData
Summary:
Represents a single lane entry used when composing a network (net) prefab. This struct is an IBufferElementData element, intended to be stored in a DynamicBuffer on an Entity that represents a composed net/prefab. It carries a reference to the lane Entity, its local/world position, bitflags describing lane properties, and small integer fields for carriageway/group/index classification. The type is annotated with InternalBufferCapacity(0), meaning no inline capacity is reserved on the entity (buffer elements are always heap-allocated).
Fields
-
public Entity m_Lane
Holds the Entity reference for the lane. This links to the lane entity used by the net composition. -
public float3 m_Position
The lane's position (Unity.Mathematics.float3). Typically represents the local or world position of the lane control point within the prefab composition context. -
public LaneFlags m_Flags
Bitflags describing lane properties (direction, vehicle types allowed, turn restrictions, etc.). LaneFlags is a game-specific enum/bitmask defined elsewhere in the codebase. -
public byte m_Carriageway
Small integer indicating the carriageway index or type. Used to group lanes that belong to the same carriageway (e.g., left vs right side). -
public byte m_Group
Group id for additional lane grouping/ordering within the composition. Useful for categorizing lanes for stitching or sorting. -
public byte m_Index
Index of the lane within its group/carriageway. Typically used to preserve lane order inside a composition.
Properties
- (None)
This struct exposes only public fields and does not define C# properties.
Constructors
-
public NetCompositionLane(DefaultNetLane source)
Initializes a NetCompositionLane from a DefaultNetLane source. Copies the lane Entity, position, flags, carriageway, group and index from the provided source structure. DefaultNetLane is expected to be a compatible data struct defined elsewhere in the codebase. -
(implicit)
public NetCompositionLane()
As a C# struct, a parameterless default constructor is implicitly available and will zero-initialize fields.
Methods
- (None)
This is a plain data container type (no methods defined).
Usage Example
// Example: adding NetCompositionLane entries to an entity's DynamicBuffer
public partial class NetCompositionSystem : SystemBase
{
protected override void OnUpdate()
{
// assume 'prefabEntity' is an entity representing a composed net/prefab
Entity prefabEntity = /* obtain entity */;
var em = EntityManager;
// Get or create the dynamic buffer of NetCompositionLane
var buffer = em.GetBuffer<NetCompositionLane>(prefabEntity);
// Option A: create from an existing DefaultNetLane
DefaultNetLane sourceLane = /* obtain or construct */;
buffer.Add(new NetCompositionLane(sourceLane));
// Option B: populate manually
buffer.Add(new NetCompositionLane {
m_Lane = someLaneEntity,
m_Position = new Unity.Mathematics.float3(1.0f, 0.0f, 2.0f),
m_Flags = LaneFlags.None, // example
m_Carriageway = 0,
m_Group = 1,
m_Index = 0
});
}
}
Additional notes: - InternalBufferCapacity(0) forces buffer storage to be allocated separately from the Entity's chunk; use this when the number of lanes is variable or potentially large. - float3 is from Unity.Mathematics; LaneFlags and DefaultNetLane are defined elsewhere in the game's code—check their definitions to understand flag bits and source semantics. - This struct is intended for use within the Unity Entities (ECS) workflow for building/modifying net prefabs at runtime or in editor tooling for Cities: Skylines 2 modding.