Skip to content

Game.Prefabs.NetCrosswalkData

Assembly:
Assembly-CSharp (default game assembly for Unity mods)

Namespace:
Game.Prefabs

Type:
struct

Base:
IComponentData, IQueryTypeParameter

Summary:
Component data representing a net (road) crosswalk. Stores a reference to the lane entity that the crosswalk belongs to and the two endpoint positions in world space. Intended for use with Unity's DOTS/ECS (Unity.Entities) to attach crosswalk metadata to entities so systems/jobs can read or write crosswalk geometry/association.


Fields

  • public Entity m_Lane
    Reference to the lane entity this crosswalk is associated with. Use this to link the crosswalk to the lane (for routing, rendering, or logic that needs lane identity).

  • public float3 m_Start
    World-space position (Unity.Mathematics.float3) for the start endpoint of the crosswalk.

  • public float3 m_End
    World-space position (Unity.Mathematics.float3) for the end endpoint of the crosswalk.

Properties

  • This struct defines no properties. All data is exposed via public fields.

Constructors

  • NetCrosswalkData() (implicit default)
    As a value type (struct) this has the implicit default constructor that zeros fields. Typical construction is via an object initializer:
var cw = new NetCrosswalkData {
    m_Lane = laneEntity,
    m_Start = new float3(0f, 0f, 0f),
    m_End = new float3(1f, 0f, 0f)
};

Methods

  • This struct defines no methods. It is plain component data used for storage/queries.

Usage Example

// Inside a SystemBase or a class with access to an EntityManager:
using Unity.Entities;
using Unity.Mathematics;
using Game.Prefabs;

// Creating and adding the component to an entity:
Entity crosswalkEntity = entityManager.CreateEntity();
Entity laneEntity = /* obtain lane entity */;
float3 startPos = new float3(10f, 0f, 5f);
float3 endPos   = new float3(12f, 0f, 5f);

var crosswalk = new NetCrosswalkData {
    m_Lane = laneEntity,
    m_Start = startPos,
    m_End = endPos
};

entityManager.AddComponentData(crosswalkEntity, crosswalk);

// Querying / using the component in a system:
Entities
    .WithName("ProcessCrosswalks")
    .ForEach((ref NetCrosswalkData cw) =>
    {
        // Example: compute mid point or perform logic using cw.m_Lane, cw.m_Start, cw.m_End
        float3 mid = (cw.m_Start + cw.m_End) * 0.5f;
        // ... processing ...
    }).ScheduleParallel();

Notes: - float3 coordinates are in world space (same units as other scene geometry). - Because fields are public, systems and jobs can read and mutate them directly. - The IQueryTypeParameter marker indicates this type is intended to be used in query contexts (DOTS/ECS queries).