Skip to content

Game.Vehicles.PassengerTransport

Assembly:
Game

Namespace:
Game.Vehicles

Type:
struct

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

Summary:
PassengerTransport is an empty marker/component struct used with Unity's ECS in Cities: Skylines 2 to mark entities that represent passenger-transporting vehicles (or otherwise participate in passenger transport logic). It is defined with a fixed non-zero size via the StructLayout attribute ([StructLayout(LayoutKind.Sequential, Size = 1)]) so it can be treated as a serializable, non-zero-sized component by native/serialization systems. The struct carries no data — its presence on an entity is used purely for tagging/querying behavior.


Fields

  • This struct has no instance fields.
    This is an intentionally empty marker component. The StructLayout attribute gives it a size of 1 byte so it is non-zero sized for serialization/native layout reasons.

Properties

  • This struct exposes no properties.
    It only implements marker/behavior interfaces for ECS and Colossal serialization.

Constructors

  • public PassengerTransport()
    Structs have an implicit parameterless constructor; there is no custom constructor defined. Use the default value (new PassengerTransport()) when adding the component to an entity.

Methods

  • This struct defines no methods.

Usage Example

using Unity.Entities;
using Game.Vehicles;

// Add the marker component to an entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
// If you already have an entity:
entityManager.AddComponentData(entity, new PassengerTransport());

// Or add the component type (for a tag-like component)
entityManager.AddComponent<PassengerTransport>(entity);

// Query entities that have the PassengerTransport marker
public partial class PassengerVehicleSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities
            .WithAll<PassengerTransport>()
            .ForEach((Entity entity, in SomeVehicleData vehicle) =>
            {
                // Handle passenger-transport-specific logic here
            })
            .Schedule();
    }
}

Notes and tips: - Because PassengerTransport is empty, check how your version of Unity.Entities expects empty/tag components to be added/queried (AddComponent, AddComponentData, or AddSharedComponent may differ between versions). - The [StructLayout(LayoutKind.Sequential, Size = 1)] attribute ensures a non-zero size which helps with some native serialization and memory layout requirements used by Colossal's serialization and modding tooling.