Skip to content

Game.SecondaryLane

Assembly: Game (in-game assembly)
Namespace: Game.Net

Type: struct

Base: System.ValueType
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable

Summary: SecondaryLane is an empty marker/tag ECS component used to mark a lane as a "secondary" lane within the game's networking/lane systems. It contains no payload data and exists solely for identification/querying purposes in DOTS systems and for compatible serialization via the Colossal serialization interfaces. The struct is marked with StructLayout(Size = 1) to ensure a minimal (1 byte) footprint for packing/serialization.


Fields

This struct does not declare any instance fields. It is an empty marker type; the source uses StructLayout(LayoutKind.Sequential, Size = 1) to give it a 1-byte size for storage/serialization purposes.

  • (no fields)

{{ This component is intentionally empty to minimize memory and serialization overhead while still providing a stable type to represent "secondary" lanes in queries and component sets. }}

Properties

  • (no properties)

{{ There are no runtime properties — use presence/absence of the component to represent state. }}

Constructors

  • Implicit default parameterless constructor (value type)

{{ As a struct, SecondaryLane uses the default value-type constructor. To attach this marker to an entity, create a new instance with new SecondaryLane() (no parameters) and add it via the EntityManager or relevant DOTS API. }}

Methods

  • (no methods)

{{ No methods are defined. Behavior is driven by systems that check for the presence of this component via queries (e.g., SystemAPI/EntityManager queries). The IEmptySerializable interface indicates the type can be serialized/deserialized by the game's serialization plumbing as an empty marker. }}

Usage Example

// Add the marker to an entity
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
em.AddComponentData(laneEntity, new SecondaryLane());

// Remove the marker
em.RemoveComponent<SecondaryLane>(laneEntity);

// Query for all entities that have the marker in a system (example using SystemAPI)
public partial struct SecondaryLaneProcessingSystem : ISystem
{
    public void OnUpdate(ref SystemState state)
    {
        // Iterate all entities that have SecondaryLane
        foreach (var (entity) in SystemAPI.Query<Entity>().WithAll<SecondaryLane>())
        {
            // Process secondary lane entity
        }
    }
}

{{ Notes: - Use this marker in systems that need to treat secondary lanes differently (rendering flags, traffic rules, AI behavior, etc.). - Because the type implements IEmptySerializable, it is intended to participate in the Colossal serialization system as an empty component — ensure serialization code/pathways in your mod/tooling respect that. - The 1-byte size layout makes storage efficient for large numbers of entities. }}