Skip to content

Game.Prefabs.EconomyPrefab

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: class

Base: PrefabBase

Summary:
EconomyPrefab is a prefab-style MonoBehaviour that exposes a large set of economic tuning parameters (wages, consumption, efficiencies, refund settings, etc.) via serializable fields and tooltips for the editor. During initialization it writes those values into the ECS component EconomyParameterData on the created entity (LateInitialize). This prefab is used to centralize and expose game-balancing values for the Cities: Skylines 2 economy systems so they can be edited in the Unity inspector and applied to the runtime ECS world.


Fields

  • public float m_ExtractorCompanyExportMultiplier = 0.85f
    Multiplier applied to export price for resources generated by extractor companies sold to the outside connections (OC).

  • public int m_Wage0
    Wage for Job level: Simple (minimum education: Uneducated). All citizens can work in jobs below their highest education level.

  • public int m_Wage1
    Wage for Job level: Basic (minimum education: Poorly educated).

  • public int m_Wage2
    Wage for Job level: Senior (minimum education: Educated).

  • public int m_Wage3
    Wage for Job level: Specialist (minimum education: Well educated).

  • public int m_Wage4
    Wage for Job level: Manager (minimum education: Highly educated).

  • public float m_CommuterWageMultiplier
    Multiplier to calculate wages for commuters (example: commuter on Basic job earns Wage1 * this multiplier).

  • public float m_CityServiceWageAdjustment = 0.5f
    Wage multiplier applied to city service worker wages (adjusts wages for city service jobs).

  • public int m_CompanyBankruptcyLimit = -5000000
    If a company's combined resources (money, inputs, outputs, in-transit resources, service resources) fall below this value, the company goes bankrupt.

  • public int m_ResidentialMinimumEarnings
    Balancing value subtracted from earned wage before taxes (used to compute household tax income).

  • public int m_UnemploymentBenefit
    Money paid by government to working-age citizens who are unemployed (helps them pay rent and buy resources).

  • public int m_Pension
    Money paid by government to senior citizens who don't work.

  • public int m_FamilyAllowance
    Money paid by government to households per child (offsets children's consumption).

  • public float2 m_ResourceConsumptionMultiplier = new float2(0.3f, 10f)
    Per-wealth-tier multiplier for how household stored resources are consumed. X = poorest, Y = wealthiest. Resources bought are converted to “resource money” which is consumed over time.

  • public float m_ResourceConsumptionPerCitizen = 3.5f
    Overall daily resource consumption multiplier per citizen.

  • public float m_TouristConsumptionMultiplier
    Daily resource consumption multiplier for tourists; tourists consume resources similarly to citizens while visiting.

  • public float m_WorkDayStart
    Normalized (0..1) time when citizens go to work (0 = 00:00, 1 = 24:00). Example: 0.35 ~ 7:00.

  • public float m_WorkDayEnd
    Normalized (0..1) time when citizens return home from work.

  • public float m_IndustrialEfficiency
    Global industrial efficiency affecting industrial production rate.

  • public float m_CommercialEfficiency
    Global commercial efficiency affecting commercial service rate.

  • public float m_ExtractorEfficiency
    Global specialized (extractor) efficiency affecting extractor production.

  • public float m_TrafficReduction = 0.0004f
    Global value controlling how much traffic moves in the city. Higher => more vehicles; lower => fewer vehicles and more teleported purchases.

  • public float m_MaxCitySpecializationBonus = 0.15f
    Maximum City Specialization Bonus used in building efficiency calculations (affects zoned buildings).

  • public int m_ResourceProductionCoefficient = 10000000
    Coefficient used when calculating City Specialization Bonus related to production: prod/(prod+coefficient) * max.

  • public float m_MixedBuildingCompanyRentPercentage = 0.3f
    Percentage of rent contribution from a commercial company for mixed residential/commercial buildings.

  • public float3 m_LandValueModifier = new float3(0.5f, 0.7f, 0.3f)
    Multipliers for Land Value effect on rent: X = Residential, Y = Commercial, Z = Industrial/Office.

  • public float3 m_RentPriceBuildingZoneTypeBase = new float3(1f, 2f, 0.8f)
    ZoneType base values used in rent calculation: X = Residential, Y = Commercial, Z = Industrial/Office.

  • public float m_ResidentialUpkeepLevelExponent = 1.3f
    Exponent applied to residential upkeep per building level (higher levels scale upkeep).

  • public float m_CommercialUpkeepLevelExponent = 2.1f
    Exponent applied to commercial upkeep per building level.

  • public float m_IndustrialUpkeepLevelExponent = 2f
    Exponent applied to industrial/office upkeep per building level.

  • public int m_PerOfficeResourceNeededForIndustrial = 2000
    Balancing value describing how many industrial resource units correspond to one unit demand in offices (ties industrial production to office demand).

  • public float m_UnemploymentAllowanceMaxDays = 5f
    Maximum number of days a citizen can receive unemployment benefits; afterwards they might move out or become homeless.

  • public int m_ShopPossibilityIncreaseDivider = 1000
    Divider used to compute probability that a household will perform a shopping action based on stored resources.

  • public int m_PlayerStartMoney = 800000
    Money given to the player at the start of a new city.

  • public float3 m_BuildRefundPercentage = new float3(0.75f, 0.5f, 0.25f)
    Building refund percentages for different refund time ranges (x,y,z correspond to ranges).

  • public float3 m_BuildRefundTimeRange = new float3(0.04f, 0.5f, 1f)
    Building refund time ranges in game days corresponding to refund percentages.

  • public float m_RelocationCostMultiplier = 1f
    Multiplier for building relocation cost.

  • public float3 m_RoadRefundPercentage = new float3(1f, 0.75f, 0.5f)
    Road refund percentages for different refund time ranges.

  • public float3 m_RoadRefundTimeRange = new float3(0.04f, 0.5f, 1f)
    Road refund time ranges in game days corresponding to road refund percentages.

  • public int3 m_TreeCostMultipliers = new int3(2, 5, 10)
    Age multipliers for tree planting cost (X = Young, Y = Mature, Z = Elderly).

  • public AnimationCurve m_MapTileUpkeepCostMultiplier
    AnimationCurve used to compute map tile upkeep multiplier based on the tile's cost.

  • public float2 m_LoanMinMaxInterestRate = new float2(0.02f, 0.2f)
    Min and max loan interest rate (x = min, y = max).

Properties

  • None declared on this type.
    EconomyPrefab exposes tuning values via public fields and writes them into the ECS component EconomyParameterData in LateInitialize.

Constructors

  • public EconomyPrefab()
    Default parameterless constructor (standard Unity/MonoBehaviour instantiation). Instances are created/initialized by Unity; no custom construction logic in the class.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Adds the EconomyParameterData component to the prefab's component list so that entities created from this prefab will include that component. Calls base.GetPrefabComponents(components) and then components.Add(ComponentType.ReadWrite()).

  • public override void GetArchetypeComponents(HashSet<ComponentType> components)
    Override present but only calls base implementation. Intended extension point if additional archetype components are required.

  • public override void LateInitialize(EntityManager entityManager, Entity entity)
    Writes the prefab's field values into the EconomyParameterData component on the provided entity via entityManager.SetComponentData(). Most fields are copied directly; the AnimationCurve field is wrapped into an AnimationCurve1 instance before being assigned to EconomyParameterData.m_MapTileUpkeepCostMultiplier.

Usage Example

// Example: Read the EconomyParameterData written by EconomyPrefab after the prefab has been instantiated
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity prefabEntity = /* the entity created from EconomyPrefab */;
if (entityManager.HasComponent<EconomyParameterData>(prefabEntity))
{
    EconomyParameterData econ = entityManager.GetComponentData<EconomyParameterData>(prefabEntity);
    Debug.Log($"Wage level 0: {econ.m_Wage0}, Player start money: {econ.m_PlayerStartMoney}");
}

Notes / Modding tips: - To change economy tuning at runtime, modify the prefab fields in the editor or customize a derived prefab and let LateInitialize push values into the ECS component. Alternatively, modify EconomyParameterData on the live entity via EntityManager.SetComponentData. - The MapTile upkeep curve is serialized as an AnimationCurve in the prefab but stored in the ECS as AnimationCurve1; keep that conversion in mind if you interact with those types.