Skip to content

Game.Settings.MotionBlurQualitySettings

Assembly: Assembly-CSharp.dll
Namespace: Game.Settings

Type: class MotionBlurQualitySettings

Base: QualitySetting

Summary:
MotionBlurQualitySettings is a quality-setting wrapper for the HDRP MotionBlur volume component. It exposes runtime options (enabled and sampleCount) and registers preset levels (Disabled, Low, Medium, High) in its static constructor. The class integrates with the game's settings UI via attributes ([SettingsUIAdvanced], [SettingsUISection("MotionBlurQualitySettings")], [SettingsUIDisableByCondition]) and applies values to a MotionBlur volume component retrieved from a VolumeProfile. It relies on UnityEngine.Rendering.HighDefinition.MotionBlur and the QualitySetting base class.


Fields

  • private static UnityEngine.Rendering.HighDefinition.MotionBlur m_MotionBlurComponent
    Static reference to the MotionBlur volume component used when applying settings. It is created (or retrieved) via CreateVolumeComponent(profile, ref m_MotionBlurComponent) in the constructor that accepts a VolumeProfile. This component is used by Apply() to set intensity and sample count.

Properties

  • public bool enabled { get; set; }
    Controls whether motion blur is enabled. Marked with [SettingsUIHidden] so it is hidden in the standard settings UI. Used by Apply() and IsOptionsDisabled().

  • public int sampleCount { get; set; }
    Number of samples used by the motion blur effect; higher numbers increase visual quality at the cost of performance. Preset values: 4 (Low), 8 (Medium), 12 (High).

  • private static MotionBlurQualitySettings highQuality { get; }

  • private static MotionBlurQualitySettings mediumQuality { get; }
  • private static MotionBlurQualitySettings lowQuality { get; }
  • private static MotionBlurQualitySettings disabled { get; }
    Private read-only preset property expressions that return configured MotionBlurQualitySettings instances for the respective quality levels. These are registered in the static constructor.

Constructors

  • public MotionBlurQualitySettings()
    Parameterless constructor. Leaves properties at their default CLR values (enabled default false, sampleCount default 0) — useful when building a custom instance before applying.

  • public MotionBlurQualitySettings(Level quality, VolumeProfile profile)
    Constructs the settings object tied to a VolumeProfile: it calls CreateVolumeComponent(profile, ref m_MotionBlurComponent) to obtain the MotionBlur volume component, then calls SetLevel(quality, apply: false) to set property values from the requested preset without immediately applying them to the component.

  • static MotionBlurQualitySettings()
    Static constructor that registers the four preset quality configurations with QualitySetting.RegisterSetting for Level.Disabled, Level.Low, Level.Medium, and Level.High. This makes the presets available to the quality system at startup.

Methods

  • public override void Apply()
    Overrides QualitySetting.Apply(). If the MotionBlur volume component (m_MotionBlurComponent) is non-null, this method:
  • Uses ApplyState on m_MotionBlurComponent.intensity to set intensity to 0f when motion blur is disabled (enabled == false).
  • Uses ApplyState on m_MotionBlurComponent.m_SampleCount to set the sample count to the value of sampleCount. Apply delegates to the base implementation first.

  • public override bool IsOptionsDisabled()
    Determines whether the options for this setting should be disabled in the UI. Returns true if the option is fully disabled via the base IsOptionFullyDisabled(); otherwise returns !enabled (i.e., disabled in UI when not enabled).

Usage Example

// Example 1: Create from a VolumeProfile and apply a preset level
var settingsFromProfile = new MotionBlurQualitySettings(Level.High, someVolumeProfile);
settingsFromProfile.Apply();

// Example 2: Create a custom configuration and apply immediately
var custom = new MotionBlurQualitySettings
{
    enabled = true,
    sampleCount = 6
};
custom.Apply();

Notes: - The class expects an HDRP VolumeProfile when binding to a MotionBlur component; ensure the profile contains a MotionBlur override or CreateVolumeComponent can add one. - Preset values registered at static initialization: - Disabled: enabled = false - Low: enabled = true, sampleCount = 4 - Medium: enabled = true, sampleCount = 8 - High: enabled = true, sampleCount = 12