Skip to content

Game.Prefabs.PublicTransportStationData

Assembly: (unspecified in source — defined in the game's assembly, typically Assembly-CSharp)
Namespace: Game.Prefabs

Type: struct

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

Summary:
PublicTransportStationData is an empty/tag component used with Unity's DOTS ECS in Cities: Skylines 2. The struct has no instance fields and exists primarily as a marker to indicate that an entity represents (or is associated with) a public transport station. The type is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] to force a non-zero size for interop/serialization reasons and implements IEmptySerializable to participate in Colossal's serialization system even though it carries no data.


Fields

  • This struct declares no managed fields.
    Notes:
  • The StructLayout attribute with Size = 1 ensures the type occupies at least one byte, which is useful for serialization/interop and avoids zero-sized-type issues in some systems.

Properties

  • This type defines no properties. It is intended as a tag/marker component only.

Constructors

  • No explicit constructors are defined. The default parameterless constructor (value-type default) is used.

Methods

  • No instance or static methods are defined.

Usage Example

using Unity.Entities;
using Game.Prefabs;

// Add the tag component to an entity
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity();
entityManager.AddComponent<PublicTransportStationData>(entity);

// Use as a query parameter to find entities tagged as public transport stations
Entities
    .WithAll<PublicTransportStationData>()
    .ForEach((Entity e) =>
    {
        // process station entity e
    }).Run();

Additional notes: - Because it implements IQueryTypeParameter, this struct can be used directly in queries (e.g., WithAll). - As an empty tag component, do not attempt to store actual station data in this type. Use separate components to hold attributes (IDs, capacities, references) and use this type to mark or filter entities that are public transport stations.