Game.Prefabs.Climate.DistanceCloudsProperties
Assembly:
Assembly-CSharp
Namespace:
Game.Prefabs.Climate
Type:
class
Base:
OverrideablePropertiesComponent
Summary:
Component used by weather prefabs to represent and override HDRP distance-cloud parameters. This component exposes several volume parameter fields (opacity and per-layer strengths plus altitude) and binds them from/to an HD CloudLayer volume component when volumes are bound. It is registered in the component menu under "Weather/" and is intended to work with WeatherPrefab assets.
Fields
-
public ClampedFloatParameter m_Opacity
Default: 1.0f. Controls overall opacity of the distance cloud layer. This is a ClampedFloatParameter (min 0, max 1). -
public ClampedFloatParameter m_CumulusStrength
Default: 1.0f. Maps to the cloud layer's layerA.opacityR channel — used here as the cumulus layer strength (range 0..1). -
public ClampedFloatParameter m_StratusStrength
Default: 1.0f. Maps to the cloud layer's layerA.opacityG channel — used here as the stratus layer strength (range 0..1). -
public ClampedFloatParameter m_CirrusStrength
Default: 1.0f. Maps to the cloud layer's layerA.opacityB channel — used here as the cirrus layer strength (range 0..1). -
public ClampedFloatParameter m_WispyStrength
Default: 1.0f. Maps to the cloud layer's layerA.opacityA channel — used here as the wispy layer strength (range 0..1). -
public MinFloatParameter m_Altitude
Default: 2000.0f. Maps to the cloud layer's layerA.altitude value. This is a MinFloatParameter (minimum 0).
Properties
- This class does not declare C# properties. It exposes HDRP volume parameter fields (ClampedFloatParameter / MinFloatParameter) as public fields for use by the prefab/volume binding system.
Constructors
public DistanceCloudsProperties()
Default parameterless constructor (implicit). The fields are initialized inline with the defaults declared in the class:- m_Opacity = 1f
- m_CumulusStrength = 1f
- m_StratusStrength = 1f
- m_CirrusStrength = 1f
- m_WispyStrength = 1f
- m_Altitude = 2000f
Methods
protected override void OnBindVolumeProperties(Volume volume)
: System.Void
When the component is asked to bind to a Volume, this override obtains (or creates) the Game.Rendering.CloudLayer volume component and copies its relevant parameters into the fields of this component. Implementation details:- Uses VolumeHelper.GetOrCreateVolumeComponent(volume, ref component) to ensure a CloudLayer instance exists on the provided Volume.
- Copies component.opacity -> m_Opacity
- Copies component.layerA.opacityR -> m_CumulusStrength
- Copies component.layerA.opacityG -> m_StratusStrength
- Copies component.layerA.opacityB -> m_CirrusStrength
- Copies component.layerA.opacityA -> m_WispyStrength
- Copies component.layerA.altitude -> m_Altitude
Notes: - The method is protected and overrides behavior from the base OverrideablePropertiesComponent. The system that binds volumes to prefabs will call this at the appropriate times; it is not intended to be called publicly. - This component assumes an HD-style CloudLayer with a layerA structure containing opacity channels and altitude.
Usage Example
// Typical usage inside game code or editor scripts:
// Add or get the component on a prefab/GO and change values directly.
// Binding from a Volume to populate these fields is handled by the prefab/volume system
// via the protected OnBindVolumeProperties override.
var comp = gameObject.AddComponent<Game.Prefabs.Climate.DistanceCloudsProperties>();
comp.m_Opacity.value = 0.85f;
comp.m_CumulusStrength.value = 0.7f;
comp.m_StratusStrength.value = 0.5f;
comp.m_CirrusStrength.value = 0.2f;
comp.m_WispyStrength.value = 0.3f;
comp.m_Altitude.value = 1800f;
// After the prefab/volume binding step runs, these fields will reflect the values copied from
// the corresponding Game.Rendering.CloudLayer component:
// e.g. comp.m_CumulusStrength.value == cloudLayer.layerA.opacityR
{{ Additional information: - Attribute: [ComponentMenu("Weather/", new Type[] { typeof(WeatherPrefab) })] — places this component under the Weather menu in the component add UI and signals association with WeatherPrefab. - Dependencies: Uses Unity HDRP volume parameter types (ClampedFloatParameter, MinFloatParameter) and a game-specific CloudLayer type (Game.Rendering). Ensure the HD cloud layer and Volume system are available when using this component. - Purpose: Intended to allow prefab-driven overrides of distance-cloud settings for weather systems (modders can modify the public parameters directly or rely on the prefab/volume binding to populate them). }}