Skip to content

Game.Prefabs.TransportType

Assembly:
Assembly-CSharp (main game assembly used by Cities: Skylines 2; types may also be exposed to mods via game's managed assemblies)

Namespace:
Game.Prefabs

Type:
public enum

Base:
System.Enum

Summary:
Enumeration of transport/service categories used by the game to classify vehicle and passenger transport systems. Each member represents a transport mode (e.g., Bus, Train, Tram) or special sentinel values (None, Count). Mods and game systems use this enum to filter, route, display, or configure behavior specific to a transport type.


Fields

  • None = -1
    Used as an invalid or unassigned sentinel value indicating no transport type.

  • Bus
    Represents bus transport.

  • Train
    Represents train transport (surface rail intercity/commuter).

  • Taxi
    Represents taxi services/vehicles.

  • Tram
    Represents tram/streetcar transport.

  • Ship
    Represents maritime transport (ferries, ships).

  • Post
    Represents postal delivery vehicles/service.

  • Helicopter
    Represents helicopter transport.

  • Airplane
    Represents airplane/air transport (planes at airports).

  • Subway
    Represents underground metro/subway transport.

  • Rocket
    Represents rocket/space transport (if used by game for rockets).

  • Work
    Represents generic work/utility vehicle category.

  • Count
    Represents the number of transport types (useful for iteration/bounds). Usually placed last; its integer value equals the number of actual transport entries.

Properties

  • None
    This enum does not define properties.

Constructors

  • None
    Enums do not declare constructors; underlying values are assigned as shown.

Methods

  • None (aside from the standard System.Enum methods)
    No custom methods are declared on this enum. Use standard enum helpers such as Enum.GetName, Enum.GetValues, casting to/from int, etc.

Usage Example

// Basic usage
TransportType t = TransportType.Bus;

if (t == TransportType.Subway)
{
    // handle subway-specific logic
}

// Iterate all defined transport types (excluding sentinel values if desired)
foreach (TransportType type in Enum.GetValues(typeof(TransportType)))
{
    if (type == TransportType.None || type == TransportType.Count)
        continue;

    // process type
    Debug.Log($"Transport type: {type} ({(int)type})");
}

// Convert to int and back
int id = (int)TransportType.Train;
TransportType fromId = (TransportType)id;

Additional notes: - None is typically used to indicate "no selection" or an invalid/uninitialized transport type. - Count is useful for array sizing or iterating ranges; treat it as a sentinel rather than a real transport mode.