Skip to content

Game.Prefabs.Climate.WhiteBalanceProperties

Assembly:
Game (Assembly-CSharp) {{ YOUR_INFO: This class is part of the game's runtime assemblies; in Cities: Skylines 2 mods it typically lives in the main game assembly (Assembly-CSharp / Game). }}

Namespace:
Game.Prefabs.Climate

Type:
public class WhiteBalanceProperties {{ YOUR_INFO: Component used to expose white-balance (temperature/tint) settings for weather prefabs. It is a MonoBehaviour-like component used by the game's prefab system and rendering/volume binding. }}

Base:
OverrideablePropertiesComponent {{ YOUR_INFO: Inherits from a component that supports being overridden per-prefab or per-instance (used by the game's weather/prefab pipeline). }}

Summary:
This component exposes two clamped float parameters representing white-balance temperature and tint. When the prefab's volume properties are bound (OnBindVolumeProperties), it ensures an HD WhiteBalance volume component exists and copies the stored parameter values into the volume component, allowing prefab-driven white-balance control for weather/lighting. {{ YOUR_INFO: Useful when creating or editing weather prefabs to control color temperature and tint via the volume system (Unity HDRP WhiteBalance). }}


Fields

  • public ClampedFloatParameter m_Temperature = new ClampedFloatParameter(0f, -100f, 100f)
    {{ YOUR_INFO: Represents the white-balance temperature. Default value 0. Minimum -100, maximum 100. Backed by Unity/HD rendering parameter type (ClampedFloatParameter) so it integrates with the volume/profile system. }}

  • public ClampedFloatParameter m_Tint = new ClampedFloatParameter(0f, -100f, 100f)
    {{ YOUR_INFO: Represents the white-balance tint. Default value 0. Minimum -100, maximum 100. }}

Properties

  • (none declared)
    {{ YOUR_INFO: The class exposes its parameters as public fields rather than properties. They are ClampedFloatParameter instances which encapsulate value and range semantics used by the HDRP/volume system. }}

Constructors

  • public WhiteBalanceProperties()
    {{ YOUR_INFO: No explicit constructor in the source; the default parameterless constructor is used. The fields are initialized inline with their default ClampedFloatParameter instances. }}

Methods

  • protected override void OnBindVolumeProperties(Volume volume)
    {{ YOUR_INFO: Called when the prefab's volume properties are bound (part of the OverrideablePropertiesComponent lifecycle). Implementation:
  • Ensures a WhiteBalance volume component exists on the supplied Volume by calling VolumeHelper.GetOrCreateVolumeComponent.
  • Copies the stored parameters into that component: m_Temperature = component.temperature and m_Tint = component.tint. This synchronizes the prefab's white-balance parameter data with the runtime HDRP WhiteBalance volume component so the volume reflects the prefab settings. Note: Volume and WhiteBalance types come from UnityEngine.Rendering and UnityEngine.Rendering.HighDefinition. }}

Usage Example

// Example: programmatically add and configure the component on a prefab GameObject
using UnityEngine;
using Game.Prefabs.Climate;

public class ExampleSetup : MonoBehaviour
{
    void Start()
    {
        var comp = gameObject.AddComponent<WhiteBalanceProperties>();
        // set values (ClampedFloatParameter typically exposes a 'value' field/property)
        comp.m_Temperature.value = 10f; // warm
        comp.m_Tint.value = -5f;        // slight green tint

        // When the prefab/system binds volume properties, OnBindVolumeProperties
        // will copy these values into the HDRP WhiteBalance volume component.
    }
}

{{ YOUR_INFO: Notes and tips - This component is decorated with [ComponentMenu("Weather/", typeof(WeatherPrefab))], so it is intended to be used with weather prefabs and will appear in the editor component menu under Weather. - The class relies on HD rendering WhiteBalance volume component; ensure HDRP volume components are available where this is used. - ClampedFloatParameter enforces the configured min/max range (-100..100) automatically; set values within that range to avoid clamping. }}