Game.Settings.TerrainQualitySettings
Assembly: Assembly-CSharp (game)
Namespace: Game.Settings
Type: class
Base: QualitySetting
Summary:
TerrainQualitySettings is a quality-setting wrapper that controls terrain tessellation and patch size for the HD render pipeline's TerrainRendering volume component. It exposes two user-facing properties (finalTessellation and targetPatchSize) which are presented in the settings UI via attributes and are registered as Low/Medium/High presets in a static constructor. The class creates or references a TerrainRendering component from a VolumeProfile and applies the configured values when Apply() is called. This class is annotated for the game settings UI with [SettingsUIAdvanced], [SettingsUISection("TerrainQualitySettings")] and a disable-by-condition attribute.
Fields
-
private static TerrainRendering m_TerrainRenderingComponent
Holds the reference to the HD Render Pipeline's TerrainRendering volume component used to apply the tessellation and patch size values. It is created/obtained via CreateVolumeComponent when a VolumeProfile is supplied. -
private Unity.Jobs.JobHandle <producerHandle>k__BackingField
{{ YOUR_INFO }}
Properties
-
public int finalTessellation { get; set; }
Exposed setting that controls the final tessellation factor applied to terrain. Decorated for the settings UI with a slider: min = 2, max = 5, step = 1, unit = "integer". -
public int targetPatchSize { get; set; }
Exposed setting that controls the terrain patch size used by tessellation. Decorated for the settings UI with a slider: min = 4, max = 64, step = 1, unit = "integer". -
private static TerrainQualitySettings highQuality { get; }
Private preset property returning a TerrainQualitySettings instance configured for high quality (finalTessellation = 4, targetPatchSize = 12). -
private static TerrainQualitySettings mediumQuality { get; }
Private preset property returning the medium preset (finalTessellation = 3, targetPatchSize = 16). -
private static TerrainQualitySettings lowQuality { get; }
Private preset property returning the low preset (finalTessellation = 3, targetPatchSize = 24).
Constructors
-
public TerrainQualitySettings()
Default parameterless constructor. Initializes an empty instance; used by the settings system and by the preset properties. -
static TerrainQualitySettings()
Static constructor registers the low/medium/high presets with the QualitySettingbase class: - RegisterSetting(Level.Low, lowQuality)
- RegisterSetting(Level.Medium, mediumQuality)
-
RegisterSetting(Level.High, highQuality)
-
public TerrainQualitySettings(Level quality, VolumeProfile profile)
Creates/ensures the TerrainRendering component exists in the provided VolumeProfile (via CreateVolumeComponent) and sets the quality level without immediately applying changes (calls SetLevel(quality, apply: false)).
Methods
public override void Apply()
Applies the current settings to the TerrainRendering volume component. If m_TerrainRenderingComponent is non-null, Apply() calls ApplyState for each exposed setting:- ApplyState(m_TerrainRenderingComponent.finalTessellation, finalTessellation)
- ApplyState(m_TerrainRenderingComponent.targetPatchSize, targetPatchSize)
The backing methods CreateVolumeComponent, SetLevel and ApplyState are provided by the base class (QualitySetting
Usage Example
// Example: create settings from a VolumeProfile and apply them
var profile = /* obtain VolumeProfile (e.g., from a Volume component) */;
var settings = new TerrainQualitySettings(Level.High, profile);
// Adjust programmatically if desired
settings.finalTessellation = 4;
settings.targetPatchSize = 12;
// Apply to the VolumeProfile's TerrainRendering component
settings.Apply();
Additional notes: - UI attributes: - [SettingsUIAdvanced] marks this section as an advanced settings section. - [SettingsUISection("TerrainQualitySettings")] groups it under the "TerrainQualitySettings" section. - [SettingsUIDisableByCondition(typeof(TerrainQualitySettings), "IsOptionsDisabled")] hides/disables options based on a condition method named IsOptionsDisabled (defined elsewhere). - The property sliders' ranges: - finalTessellation: 2..5 (integer steps) - targetPatchSize: 4..64 (integer steps) - Presets (registered at class load): - Low: finalTessellation = 3, targetPatchSize = 24 - Medium: finalTessellation = 3, targetPatchSize = 16 - High: finalTessellation = 4, targetPatchSize = 12