Skip to content

Game.Prefabs.CityEffectInfo

Assembly: Assembly-CSharp (typical for Cities: Skylines 2 game/mod assemblies)
Namespace: Game.Prefabs

Type: Class

Base: System.Object

Summary:
Serializable container describing a single city effect modifier. Instances specify which city modifier is affected (m_Type), how the modifier value should be applied (m_Mode), and the magnitude of the change (m_Delta). This class is intended to be serialized (Unity/JSON/prefab) and used by higher-level systems that apply city-wide modifiers or effects. Refer to Game.City.CityModifierType and Game.City.ModifierValueMode for the exact enum semantics.


Fields

  • public Game.City.CityModifierType m_Type
    Identifies which city modifier this effect targets. This is an enum defined in Game.City; possible values enumerate different city-level modifiers (e.g., economy, environment, traffic-related modifiers). See Game.City.CityModifierType for full list and semantics.

  • public Game.City.ModifierValueMode m_Mode
    Specifies how m_Delta should be applied to the target modifier (for example: add, multiply, set). The exact available modes and their behavior are defined in Game.City.ModifierValueMode.

  • public float m_Delta
    Numeric magnitude of the effect. The interpretation (absolute change, percentage multiplier, etc.) depends on m_Mode. Values are stored as floats; clamping/validation (if required) should be performed by the consumer of this class.

Properties

  • None. This class exposes public fields for direct serialization and usage.

Constructors

  • public CityEffectInfo()
    No explicit constructors are declared in the source; the compiler-provided parameterless constructor is available. Instances are typically created and initialized with object initializer syntax or by deserialization.

Example:

var effect = new CityEffectInfo {
    m_Type = CityModifierType.Economy,
    m_Mode = ModifierValueMode.Add,
    m_Delta = 0.1f
};

Methods

  • None defined in this class. Behavior and application logic are handled elsewhere (systems that read CityEffectInfo instances and apply changes to city state).

Usage Example

// Create a simple effect that adds 10% to an economy modifier
var economyBoost = new CityEffectInfo {
    m_Type = CityModifierType.Economy,
    m_Mode = ModifierValueMode.Add, // or appropriate enum value from Game.City
    m_Delta = 0.10f
};

// Typical usage: add to a list on a ScriptableObject/prefab or pass to an effect applier
myEffectSet.effects.Add(economyBoost);

Notes: - The class is marked [Serializable], so Unity will serialize it when used as a field in MonoBehaviour/ScriptableObject/prefab, and mod tools can deserialize it from JSON/STL. - Check the definitions and documentation of Game.City.CityModifierType and Game.City.ModifierValueMode to understand valid enum values and how m_Delta is interpreted for each mode.