Skip to content

Game.Routes.BusStop

Assembly:
Game

Namespace:
Game.Routes

Type:
struct

Base:
System.ValueType, implements IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
BusStop is an empty marker component (a "tag" component) used by the routing / transit systems to mark entities that represent bus stops. It is defined as a 1-byte sequential-layout struct to ensure it is blittable and occupies storage when used in ECS component arrays. The implemented interfaces indicate it is a Unity ECS component (IComponentData), can be used in query type parameters (IQueryTypeParameter), and participates in Colossal's empty-struct serialization contract (IEmptySerializable).


Fields

  • (none)
    This struct declares no instance fields. The StructLayout attribute with Size = 1 ensures the type has non-zero size at runtime despite being empty.

Properties

  • (none)
    No properties are defined on this type.

Constructors

  • (implicit) default BusStop()
    As an empty value type, BusStop has the implicit parameterless constructor produced by the runtime. No explicit constructors are declared in source.

Methods

  • (none)
    The type declares no methods.

Usage Example

// Add the marker component to an existing entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
entityManager.AddComponentData(someEntity, new Game.Routes.BusStop());

// Use in a SystemBase/ISystem query to operate on entities that are bus stops
public class BusStopSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities
            .WithAll<Game.Routes.BusStop>()
            .ForEach((Entity e) =>
            {
                // Handle bus stop logic for entity e
            })
            .ScheduleParallel();
    }
}

{{ The BusStop struct is intended purely as a lightweight tag to identify bus stop entities within the game's ECS. Because it is empty, it should be used solely for presence/absence checks (e.g., WithAll/WithNone or Add/Remove component calls). The StructLayout(Size = 1) prevents the empty-struct optimization that could otherwise produce issues with native/ECS storage or serialization. }}