Game.Settings.FogQualitySettings
Assembly: Assembly-CSharp
Namespace: Game.Settings
Type: class
Base: QualitySetting
Summary:
FogQualitySettings is a quality-setting wrapper that controls the HDRP Fog volume component for the game. It exposes an "enabled" toggle (hidden in the UI by attribute) and coordinates with the VolumetricsQualitySettings to properly enable/disable volumetrics when fog is toggled. The class is decorated with settings UI attributes (SettingsUIAdvanced, SettingsUISection("FogQualitySettings"), SettingsUIDisableByCondition) so it integrates with the game's settings UI logic.
Fields
-
private static UnityEngine.Rendering.HighDefinition.Fog m_FogComponent
This static field holds a reference to the Fog volume component (HDRP Fog) associated with a VolumeProfile. It's created/located via CreateVolumeComponent when a VolumeProfile is supplied in the constructor and used by Apply() to toggle the component's enabled state. -
private static FogQualitySettings lowQuality
A private static factory-style getter that produces a FogQualitySettings instance configured for the "Low" level (enabled = true). Registered in the static constructor as the mapping for Level.Low. -
private static FogQualitySettings disabled
A private static factory-style getter that produces a FogQualitySettings instance configured for the "Disabled" level (enabled = false). Registered in the static constructor as the mapping for Level.Disabled.
Properties
public bool enabled { get; set; }
Exposes whether fog is enabled. Marked with [SettingsUIHidden] so it is not directly shown in the settings UI. When Apply() runs, this value is used to enable/disable the HDRP Fog component and to update the VolumetricsQualitySettings accordingly.
Constructors
static FogQualitySettings()
Type initializer that registers setting instances and a mock display name with the QualitySetting system:- RegisterMockName(Level.Low, "Enabled")
- RegisterSetting(Level.Disabled, disabled)
-
RegisterSetting(Level.Low, lowQuality) This ties the FogQualitySettings to the game's quality-level infrastructure.
-
public FogQualitySettings()
Default parameterless constructor. -
public FogQualitySettings(Level quality, VolumeProfile profile)
Constructor that attaches this setting to a specific VolumeProfile. It calls CreateVolumeComponent(profile, ref m_FogComponent) to locate/create the HDRP Fog component in the provided profile, then calls SetLevel(quality, apply: false) to initialize the instance to the requested quality level without immediately applying changes.
Methods
public override void Apply()
Applies the current setting state to the game. Implementation details:- Calls base.Apply().
- If m_FogComponent is available, it toggles the Fog volume component's enabled state to match the setting (using ApplyState helper).
- Retrieves the VolumetricsQualitySettings instance via SharedSettings.instance.graphics.GetQualitySetting
() and sets its disableSetting to !enabled so volumetric quality can be disabled when fog is off. - If fog is being disabled, it also explicitly sets qualitySetting.enabled = enabled (i.e., false) to ensure volumetrics are turned off.
Notes: - CreateVolumeComponent and SetLevel are provided by the QualitySetting base class (or related helpers) and are used to bind this setting to HDRP volume components and to persist/restore levels. - The class interacts with SharedSettings and VolumetricsQualitySettings to coordinate fog and volumetric rendering states.
Usage Example
// Example: create the setting for a specific VolumeProfile and apply it
var fogProfile = /* obtain a UnityEngine.Rendering.VolumeProfile instance */;
var fogSetting = new FogQualitySettings(QualitySetting.Level.Low, fogProfile);
// Toggle fog off and apply
fogSetting.enabled = false;
fogSetting.Apply();