Skip to content

Game.Prefabs.VehicleLaunchData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: IComponentData, IQueryTypeParameter

Summary:
VehicleLaunchData is a lightweight ECS component used to store the transport mode for a vehicle when a vehicle prefab is being launched or instantiated. It is intended for use with Unity's DOTS/ECS patterns in Cities: Skylines 2 modding, enabling systems and jobs to query entities by the type of transport they represent (e.g., car, bus, train).


Fields

  • public TransportType m_TransportType
    This field holds the transport mode for the vehicle. TransportType is an enum (defined elsewhere in the codebase) that represents different vehicle categories such as car, bus, tram, train, ship, plane, etc. Use this component to tag or filter vehicle-related entities by their transport type in systems, queries, or job scheduling.

Properties

  • This type has no properties. It only exposes the public field m_TransportType.

Constructors

  • public VehicleLaunchData()
    No explicit constructor is defined in the source; the default parameterless constructor is provided by the C# compiler for the struct. Initialize instances either with object initializer syntax or by assigning the field directly.

Methods

  • This type defines no methods. It is a plain data-only component (IComponentData / IQueryTypeParameter) intended for storage and querying.

Usage Example

// Create an entity and set the VehicleLaunchData component:
var archetype = entityManager.CreateArchetype(typeof(VehicleLaunchData));
var entity = entityManager.CreateEntity(archetype);
entityManager.SetComponentData(entity, new VehicleLaunchData { m_TransportType = TransportType.Car });

// Or used inside a system query:
Entities
    .WithAll<VehicleLaunchData>()
    .ForEach((ref VehicleLaunchData launchData) =>
    {
        if (launchData.m_TransportType == TransportType.Bus)
        {
            // handle bus-specific initialization/logic
        }
    }).Schedule();