Class VolumeManager
The Volume
Inherited Members
Namespace: UnityEngine .Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public sealed class VolumeManager
Remarks
The Volume
- The default VolumeProfile defined in the Graphics Settings.
- The default VolumeProfile defined in the Quality Settings.
These profiles represent the baseline state of all volume parameters, and the VolumeManager interpolates values between them to create a final blended VolumeStack for each camera. Every frame, the VolumeManager updates the parameters of local and global VolumeComponents attached to game objects and ensures that the correct interpolation is applied across different volumes. The VolumeManager acts as the central "point of truth" for all VolumeComponent parameters in a scene. It provides default states for volume settings and dynamically interpolates between different VolumeProfiles to manage changes during runtime. This system is used to handle dynamic environmental and post-processing effects in Unity, ensuring smooth transitions across scene changes and camera views.
The VolumeManager integrates seamlessly with Unity's Scriptable Render Pipelines, applying the appropriate settings for rendering effects such as lighting, bloom, exposure, etc., in real time.
Properties
baseComponentTypeArray
The current list of all available types that derive from Volume
Declaration
public Type[] baseComponentTypeArray { get; }
Property Value
Type | Description |
---|---|
Type[] |
See Also
baseComponentTypes
The current list of all available types that derive from Volume
Declaration
[Obsolete("Please use baseComponentTypeArray instead.")]
public IEnumerable<Type> baseComponentTypes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Type> |
See Also
customDefaultProfiles
Collection of additional default profiles that can be used to override default values for volume components
in a way that doesn't cause any overhead at runtime. Unity applies these Volume Profiles to its internal
component default state after global
Declaration
public ReadOnlyCollection<VolumeProfile> customDefaultProfiles { get; }
Property Value
Type | Description |
---|---|
Read |
See Also
globalDefaultProfile
Global default profile that provides default values for volume components. VolumeManager applies
this profile to its internal component default state first, before quality
Declaration
public VolumeProfile globalDefaultProfile { get; }
Property Value
Type | Description |
---|---|
Volume |
See Also
instance
The current singleton instance of Volume
Declaration
public static VolumeManager instance { get; }
Property Value
Type | Description |
---|---|
Volume |
See Also
isInitialized
Returns whether Initialize(Volume
Declaration
public bool isInitialized { get; }
Property Value
Type | Description |
---|---|
bool |
See Also
qualityDefaultProfile
Quality level specific volume profile that is applied to the default state after
global
Declaration
public VolumeProfile qualityDefaultProfile { get; }
Property Value
Type | Description |
---|---|
Volume |
See Also
stack
A reference to the main Volume
Declaration
public VolumeStack stack { get; set; }
Property Value
Type | Description |
---|---|
Volume |
See Also
Methods
CheckDefaultVolumeState()
Checks component default state. This is only used in the editor to handle entering and exiting play mode because the instances created during playmode are automatically destroyed.
Declaration
[Conditional("UNITY_EDITOR")]
public void CheckDefaultVolumeState()
See Also
CheckStack(VolumeStack)
Checks the state of a given stack. This is only used in the editor to handle entering and exiting play mode because the instances created during playmode are automatically destroyed.
Declaration
[Conditional("UNITY_EDITOR")]
public void CheckStack(VolumeStack stack)
Parameters
Type | Name | Description |
---|---|---|
Volume |
stack | The stack to check. |
See Also
CreateStack()
Creates and returns a new Volume
Declaration
public VolumeStack CreateStack()
Returns
Type | Description |
---|---|
Volume |
A new Volume |
See Also
Deinitialize()
Deinitialize VolumeManager. Should be called from RenderPipeline.Dispose().
Declaration
public void Deinitialize()
See Also
DestroyStack(VolumeStack)
Destroy a Volume Stack
Declaration
public void DestroyStack(VolumeStack stack)
Parameters
Type | Name | Description |
---|---|---|
Volume |
stack | Volume Stack that needs to be destroyed. |
See Also
GetVolumeComponentDefaultState(Type)
Retrieve the default state for a given VolumeComponent type. Default state is defined as "default-constructed VolumeComponent + Default Profiles evaluated in order".
Declaration
public VolumeComponent GetVolumeComponentDefaultState(Type volumeComponentType)
Parameters
Type | Name | Description |
---|---|---|
Type | volumeComponentType | Type of VolumeComponent |
Returns
Type | Description |
---|---|
Volume |
VolumeComponent in default state, or null if the type is not found |
Remarks
If you want just the VolumeComponent with default-constructed values without overrides from
Default Profiles, use Create
See Also
GetVolumes(LayerMask)
Get all volumes on a given layer mask sorted by influence.
Declaration
public Volume[] GetVolumes(LayerMask layerMask)
Parameters
Type | Name | Description |
---|---|---|
Layer |
layerMask | The LayerMask that Unity uses to filter Volumes that it should consider. |
Returns
Type | Description |
---|---|
Volume[] | An array of volume. |
See Also
Initialize(VolumeProfile, VolumeProfile)
Initialize VolumeManager with specified global and quality default volume profiles that are used to evaluate
the default state of all VolumeComponents. Should be called from Render
Declaration
public void Initialize(VolumeProfile globalDefaultVolumeProfile = null, VolumeProfile qualityDefaultVolumeProfile = null)
Parameters
Type | Name | Description |
---|---|---|
Volume |
globalDefaultVolumeProfile | Global default volume profile. |
Volume |
qualityDefaultVolumeProfile | Quality default volume profile. |
See Also
IsComponentActiveInMask<T>(LayerMask)
Checks if a Volume
Declaration
public bool IsComponentActiveInMask<T>(LayerMask layerMask) where T : VolumeComponent
Parameters
Type | Name | Description |
---|---|---|
Layer |
layerMask | The LayerMask to check against |
Returns
Type | Description |
---|---|
bool |
|
Type Parameters
Name | Description |
---|---|
T | A type derived from Volume |
See Also
OnVolumeComponentChanged(VolumeComponent)
Call when a VolumeComponent is modified to trigger default state update if necessary.
Declaration
public void OnVolumeComponentChanged(VolumeComponent component)
Parameters
Type | Name | Description |
---|---|---|
Volume |
component | VolumeComponent that has changed. |
See Also
OnVolumeProfileChanged(VolumeProfile)
Call when a VolumeProfile is modified to trigger default state update if necessary.
Declaration
public void OnVolumeProfileChanged(VolumeProfile profile)
Parameters
Type | Name | Description |
---|---|---|
Volume |
profile | VolumeProfile that has changed. |
See Also
Register(Volume)
Registers a new Volume in the manager. Unity does this automatically when a new Volume is enabled, or its layer changes, but you can use this function to force-register a Volume that is currently disabled.
Declaration
public void Register(Volume volume)
Parameters
Type | Name | Description |
---|---|---|
Volume | volume | The volume to register. |
See Also
Register(Volume, int)
Registers a new Volume in the manager. Unity does this automatically when a new Volume is enabled, or its layer changes, but you can use this function to force-register a Volume that is currently disabled.
Declaration
[Obsolete("Please use the Register without a given layer index #from(6000.0)", false)]
public void Register(Volume volume, int layer)
Parameters
Type | Name | Description |
---|---|---|
Volume | volume | The volume to register. |
int | layer | The LayerMask that this volume is in. |
See Also
ResetMainStack()
Resets the main stack to be the default one. Call this function if you've assigned the main stack to something other than the default one.
Declaration
public void ResetMainStack()
See Also
SetCustomDefaultProfiles(List<VolumeProfile>)
Assign the given VolumeProfiles as custom default profiles and update the default component state.
Declaration
public void SetCustomDefaultProfiles(List<VolumeProfile> profiles)
Parameters
Type | Name | Description |
---|---|---|
List<Volume |
profiles | List of VolumeProfiles to set as default profiles, or null to clear them. |
See Also
SetGlobalDefaultProfile(VolumeProfile)
Assign the given VolumeProfile as the global default profile and update the default component state.
Declaration
public void SetGlobalDefaultProfile(VolumeProfile profile)
Parameters
Type | Name | Description |
---|---|---|
Volume |
profile | The VolumeProfile to use as the global default profile. |
See Also
SetQualityDefaultProfile(VolumeProfile)
Assign the given VolumeProfile as the quality default profile and update the default component state.
Declaration
public void SetQualityDefaultProfile(VolumeProfile profile)
Parameters
Type | Name | Description |
---|---|---|
Volume |
profile | The VolumeProfile to use as the quality level default profile. |
See Also
Unregister(Volume)
Unregisters a Volume from the manager. Unity does this automatically when a Volume is disabled or goes out of scope, but you can use this function to force-unregister a Volume that you added manually while it was disabled.
Declaration
public void Unregister(Volume volume)
Parameters
Type | Name | Description |
---|---|---|
Volume | volume | The Volume to unregister. |
See Also
Unregister(Volume, int)
Unregisters a Volume from the manager. Unity does this automatically when a Volume is disabled or goes out of scope, but you can use this function to force-unregister a Volume that you added manually while it was disabled.
Declaration
[Obsolete("Please use the Register without a given layer index #from(6000.0)", false)]
public void Unregister(Volume volume, int layer)
Parameters
Type | Name | Description |
---|---|---|
Volume | volume | The Volume to unregister. |
int | layer | The LayerMask that this volume is in. |
See Also
Update(VolumeStack, Transform, LayerMask)
Updates the Volume manager and stores the result in a custom Volume
Declaration
public void Update(VolumeStack stack, Transform trigger, LayerMask layerMask)
Parameters
Type | Name | Description |
---|---|---|
Volume |
stack | The stack to store the blending result into. |
Transform | trigger | A reference Transform to consider for positional Volume blending. |
Layer |
layerMask | The LayerMask that Unity uses to filter Volumes that it should consider for blending. |
See Also
Update(Transform, LayerMask)
Updates the global state of the Volume manager. Unity usually calls this once per Camera in the Update loop before rendering happens.
Declaration
public void Update(Transform trigger, LayerMask layerMask)
Parameters
Type | Name | Description |
---|---|---|
Transform | trigger | A reference Transform to consider for positional Volume blending |
Layer |
layerMask | The LayerMask that the Volume manager uses to filter Volumes that it should consider for blending. |