Skip to content

Game.Prefabs.SecondaryLaneData

Assembly:
Assembly-CSharp (runtime game assembly)

Namespace:
Game.Prefabs

Type:
struct

Base:
System.ValueType
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
Data component used by the game's prefab/road systems to describe a "secondary" lane's geometry and placement offsets. Contains flags controlling lane behavior and a set of numeric offsets and parameters used when placing, cutting, and spacing secondary lanes relative to primary lanes or the road mesh. This struct is a plain IComponentData value type intended to be attached to entities representing lane prefab instances or lane-related prototype data.


Fields

  • public SecondaryLaneDataFlags m_Flags
    Flags (likely a bitmask) that influence lane behavior. Typical uses: enable/disable features, mark lane as symmetric, reversed, or special handling during placement/rendering. Consult the enum definition of SecondaryLaneDataFlags for exact flag values.

  • public float3 m_PositionOffset
    3D position offset applied to the lane relative to the base prefab/road coordinate space. Typically used to shift the lane laterally/vertically/longitudinally in world or local space. Units are game world units (meters).

  • public float2 m_LengthOffset
    Start/end offsets along the lane's length. Interpreted as a 2D vector where x = offset at the start and y = offset at the end (or similar convention used by the engine). Used to shorten/extend the effective lane geometry along its longitudinal axis.

  • public float m_CutMargin
    Margin used when cutting or trimming lane geometry at intersections, transitions, or mesh seams. Represents an additional buffer distance to include/exclude when performing cut operations.

  • public float m_CutOffset
    Offset applied to the cut position. Allows shifting the cut plane/line slightly forward or backward relative to the nominal cut location.

  • public float m_CutOverlap
    Amount of overlap to keep when joining or trimming adjacent lane segments. Positive values produce overlap, negative may create gaps. Used to avoid visible seams or to ensure proper connection.

  • public float m_Spacing
    Lateral spacing between this secondary lane and adjacent lanes or reference geometry. Defines gap/clearance used when laying out multiple lanes side-by-side.

Properties

  • This type exposes no properties. It is a plain data struct; all data is stored in public fields.

Constructors

  • public SecondaryLaneData()
    Default parameterless constructor (compiler-provided). Initialize fields explicitly when creating an instance or rely on default(float)/enum default values.

You can also initialize via object initializer to set specific parameters.

Methods

  • This struct defines no methods. It is intended purely as data for ECS components and queries.

Usage Example

using Unity.Entities;
using Unity.Mathematics;
using Game.Prefabs;

// Create an entity with the SecondaryLaneData component and set values:
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var archetype = entityManager.CreateArchetype(typeof(SecondaryLaneData));
var e = entityManager.CreateEntity(archetype);

var laneData = new SecondaryLaneData
{
    m_Flags = SecondaryLaneDataFlags.None,           // set appropriate flags
    m_PositionOffset = new float3(0f, 0.0f, 0.5f),  // lateral/vertical/longitudinal offset
    m_LengthOffset = new float2(0.0f, -0.2f),       // start/end length adjustments
    m_CutMargin = 0.05f,
    m_CutOffset = 0.01f,
    m_CutOverlap = 0.02f,
    m_Spacing = 2.5f
};

entityManager.SetComponentData(e, laneData);

// Alternatively, use in queries:
Entities.ForEach((ref SecondaryLaneData s) =>
{
    // Read/modify lane parameters during systems processing
    s.m_PositionOffset.x += 0.1f;
}).Schedule();

Notes: - Field names mirror the underlying prefab/mesh processing code; small changes in these values can affect rendering, clipping, and connection behavior. - Consult SecondaryLaneDataFlags enum to choose appropriate flags for intended lane behavior.