Skip to content

Game.Settings.WaterQualitySettings

Assembly: Assembly-CSharp (game assembly)
Namespace: Game.Settings

Type: class

Base: QualitySetting

Summary:
A quality setting class that exposes HDRP water rendering and tessellation parameters to the game's Settings UI. Provides low/medium/high presets, binds UI sliders to internal values, creates/obtains the HDRP WaterRendering volume component, and applies settings both to the volume component and to all WaterSurface instances (e.g., toggling water flow).


Fields

  • private static WaterRendering m_WaterRenderingComponent
    A cached reference to the HDRP Volume component (WaterRendering). Used when applying tessellation parameters to the rendering pipeline. Checked for null before writing values.

Properties

  • public bool waterflow { get; set; }
    Controls whether water surfaces use flow animation. Applied to every WaterSurface in WaterSurface.instances.

  • public float maxTessellationFactor { get; set; }
    Max tessellation factor for water tessellation. Decorated with SettingsUISlider; slider range: min=0, max=15, step=0.1.

  • public float tessellationFactorFadeStart { get; set; }
    Distance at which tessellation fade begins. Decorated with SettingsUISlider; slider range: min=0, max=4000, step=1.

  • public float tessellationFactorFadeRange { get; set; }
    Range over which tessellation fades out. Decorated with SettingsUISlider; slider range: min=10, max=4000, step=1.

  • private static WaterQualitySettings highQuality { get; }
    Predefined high-quality preset (maxTessellationFactor = 10, tessellationFactorFadeStart = 150, tessellationFactorFadeRange = 1850, waterflow = true).

  • private static WaterQualitySettings mediumQuality { get; }
    Predefined medium-quality preset (maxTessellationFactor = 6, tessellationFactorFadeStart = 150, tessellationFactorFadeRange = 1850, waterflow = true).

  • private static WaterQualitySettings lowQuality { get; }
    Predefined low-quality preset (maxTessellationFactor = 2, tessellationFactorFadeStart = 150, tessellationFactorFadeRange = 1850, waterflow = false).

Constructors

  • public WaterQualitySettings()
    Default parameterless constructor. Initializes an empty instance that can be configured or used by the settings framework.

  • static WaterQualitySettings()
    Static constructor that registers the low/medium/high presets with QualitySetting.RegisterSetting for Level.Low, Level.Medium and Level.High.

  • public WaterQualitySettings(Level quality, VolumeProfile profile)
    Creates/obtains the HDRP WaterRendering volume component from the provided VolumeProfile (via CreateVolumeComponent) and sets the instance to the given quality level without immediately applying (SetLevel(quality, apply: false)).

Methods

  • public override void Apply()
    Applies current settings to the rendering component and runtime water surfaces. Implementation details:
  • Calls base.Apply().
  • If m_WaterRenderingComponent is not null, writes maxTessellationFactor, tessellationFactorFadeStart and tessellationFactorFadeRange to the corresponding fields on the WaterRendering component using ApplyState (helper inherited from base).
  • Iterates all WaterSurface.instances and sets each instance.waterFlow to the value of the waterflow property.

Usage Example

// Obtain a VolumeProfile (from scene or created profile)
VolumeProfile profile = /* get profile */;

// Create settings for a quality level and bind to the volume profile:
var waterSettings = new WaterQualitySettings(Level.High, profile);

// (Optional) modify values at runtime
waterSettings.waterflow = true;
waterSettings.maxTessellationFactor = 8f;

// Apply to HDRP water rendering and to all WaterSurface instances
waterSettings.Apply();