Game.Buildings.BuildingFlags
Assembly:
Likely the game's main assembly (exact assembly name not provided).
{{ This enum is defined in the Game.Buildings namespace of Cities: Skylines 2 game code. If you need the exact assembly name for modding references, inspect the compiled game assemblies (usually under the game's Managed folder). }}
Namespace: Game.Buildings
Type: public enum (with [Flags] attribute)
Base: System.Enum (underlying type: System.Byte)
Summary:
Represents bitwise flags describing building states or indicators (warnings/visual states) for a building. The enum is decorated with [Flags], so values can be combined using bitwise OR to represent multiple simultaneous states. The underlying storage is a single byte, so up to 8 independent flag bits are available.
{{ Use these flags to read or set compact state markers for buildings when writing mods that inspect building conditions or toggle visual indicators. Be mindful that combining too many independent states beyond 8 bits is not possible with the current underlying type. }}
Fields
-
None
Value: 0
{{ Indicates no flags are set. Use this as the default/cleared state. }} -
HighRentWarning
Value: 1
{{ Indicates a high rent warning for the building (e.g., tenants/businesses flagged because rent demand or affordability issues). }} -
StreetLightsOff
Value: 2
{{ Indicates the building's street lights are turned off (or that it is affected by street lighting being disabled). }} -
LowEfficiency
Value: 4
{{ Indicates the building is suffering from low efficiency (could affect production or service output). }} -
Illuminated
Value: 8
{{ Indicates the building is illuminated (visual lighting state). }}
Properties
- (none)
{{ This enum does not declare properties. Use the enum values directly. }}
Constructors
- (none)
{{ Enums do not declare explicit constructors in source; they have the default value (None = 0). }}
Methods
- (none)
{{ No methods are declared on this enum. Use standard enum and bitwise operations, or System.Enum utilities, to work with the flags. }}
Usage Example
// Set multiple flags
BuildingFlags flags = BuildingFlags.HighRentWarning | BuildingFlags.Illuminated;
// Check a flag (recommended for performance in Unity — avoids boxing of Enum.HasFlag)
bool isIlluminated = (flags & BuildingFlags.Illuminated) != 0;
// Add a flag
flags |= BuildingFlags.StreetLightsOff;
// Remove a flag
flags &= ~BuildingFlags.HighRentWarning;
// Toggle a flag
flags ^= BuildingFlags.LowEfficiency;
// Using HasFlag (convenient, but note: it can box the value and be slower)
bool hasLowEfficiency = flags.HasFlag(BuildingFlags.LowEfficiency);
{{ Tips: - Prefer bitwise operations ((flags & FLAG) != 0) for high-frequency checks in performance-sensitive code (Unity, jobs, or tight loops) because Enum.HasFlag boxes the enum. - Remember the underlying type is byte — only 8 flag bits are available. If you need more distinct flags, consider changing the underlying type (e.g., to ushort or int) if you control the enum definition. - When persisting or networking these flags, store them as a byte if compatible, to minimize memory/traffic overhead. }}