Game.Buildings.PublicTransportStation
Assembly: Assembly-CSharp (typical for Cities: Skylines 2 mods — actual assembly may vary)
Namespace: Game.Buildings
Type: struct
Base: System.ValueType — implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable
Summary: PublicTransportStation is an empty marker component (tag) used to mark entities that represent public transport stations (for example bus, tram, metro stations) in the ECS world. The struct is decorated with StructLayout(LayoutKind.Sequential, Size = 1) to ensure it has a non-zero size for serialization and engine compatibility. Implementing IComponentData makes it a Unity ECS component, IQueryTypeParameter allows it to be used in query type parameters, and IEmptySerializable indicates compatibility with the game's/custom serialization system for empty components.
Fields
- This struct declares no instance fields.
The StructLayout attribute with Size = 1 ensures the component occupies at least one byte, which is important for certain serialization or engine constraints even though there are no logical fields.
Properties
- This type exposes no properties.
Constructors
- Implicit default parameterless constructor (struct default)
Being a struct, it uses the implicit default constructor; there is no explicit constructor defined.
Methods
- This type defines no methods. It is intended purely as a tag component for queries and entity classification.
Usage Example
using Unity.Entities;
using Game.Buildings;
// Add the marker to an existing entity:
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity stationEntity = /* obtain or create entity */;
em.AddComponentData(stationEntity, new PublicTransportStation());
// Query for all public transport station entities in a system:
public partial class StationProcessingSystem : SystemBase
{
protected override void OnUpdate()
{
// Example: run over entities that have the PublicTransportStation tag
Entities
.WithAll<PublicTransportStation>()
.ForEach((Entity e, in SomeOtherComponent other) =>
{
// process station
}).ScheduleParallel();
}
}
Notes: - Because the component is empty, it is typically used only for filtering and tagging; store station-specific data in separate components attached to the same entity. - IEmptySerializable is used so the game's serialization pipeline can handle the empty component correctly.