Class VolumeManager
A global manager that tracks all the Volumes in the currently loaded Scenes and does all the interpolation work.
Inherited Members
Namespace: UnityEngine.Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public sealed class VolumeManager
Properties
baseComponentTypeArray
The current list of all available types that derive from VolumeComponent.
Declaration
public Type[] baseComponentTypeArray { get; }
Property Value
Type | Description |
---|---|
Type[] |
baseComponentTypes
The current list of all available types that derive from VolumeComponent.
Declaration
[Obsolete("Please use baseComponentTypeArray instead.")]
public IEnumerable<Type> baseComponentTypes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Type> |
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 globalDefaultProfile and qualityDefaultProfile. The custom profiles are applied in the order that they appear in the collection.
Declaration
public ReadOnlyCollection<VolumeProfile> customDefaultProfiles { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<VolumeProfile> |
globalDefaultProfile
Global default profile that provides default values for volume components. VolumeManager applies this profile to its internal component default state first, before qualityDefaultProfile and customDefaultProfiles.
Declaration
public VolumeProfile globalDefaultProfile { get; }
Property Value
Type | Description |
---|---|
VolumeProfile |
instance
The current singleton instance of VolumeManager.
Declaration
public static VolumeManager instance { get; }
Property Value
Type | Description |
---|---|
VolumeManager |
isInitialized
Returns whether Initialize(VolumeProfile, VolumeProfile) has been called, and the class is in valid state. It is not valid to use VolumeManager before this returns true.
Declaration
public bool isInitialized { get; }
Property Value
Type | Description |
---|---|
bool |
qualityDefaultProfile
Quality level specific volume profile that is applied to the default state after globalDefaultProfile and before customDefaultProfiles.
Declaration
public VolumeProfile qualityDefaultProfile { get; }
Property Value
Type | Description |
---|---|
VolumeProfile |
stack
A reference to the main VolumeStack.
Declaration
public VolumeStack stack { get; set; }
Property Value
Type | Description |
---|---|
VolumeStack |
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()
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 |
---|---|---|
VolumeStack | stack | The stack to check. |
CreateStack()
Creates and returns a new VolumeStack to use when you need to store the result of the Volume blending pass in a separate stack.
Declaration
public VolumeStack CreateStack()
Returns
Type | Description |
---|---|
VolumeStack | A new VolumeStack instance with freshly loaded components. |
See Also
Deinitialize()
Deinitialize VolumeManager. Should be called from RenderPipeline.Dispose().
Declaration
public void Deinitialize()
DestroyStack(VolumeStack)
Destroy a Volume Stack
Declaration
public void DestroyStack(VolumeStack stack)
Parameters
Type | Name | Description |
---|---|---|
VolumeStack | stack | Volume Stack that needs to be destroyed. |
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 |
---|---|
VolumeComponent | 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 CreateInstance(Type).
GetVolumes(LayerMask)
Get all volumes on a given layer mask sorted by influence.
Declaration
public Volume[] GetVolumes(LayerMask layerMask)
Parameters
Type | Name | Description |
---|---|---|
LayerMask | layerMask | The LayerMask that Unity uses to filter Volumes that it should consider. |
Returns
Type | Description |
---|---|
Volume[] | An array of volume. |
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 RenderPipeline constructor.
Declaration
public void Initialize(VolumeProfile globalDefaultVolumeProfile = null, VolumeProfile qualityDefaultVolumeProfile = null)
Parameters
Type | Name | Description |
---|---|---|
VolumeProfile | globalDefaultVolumeProfile | Global default volume profile. |
VolumeProfile | qualityDefaultVolumeProfile | Quality default volume profile. |
IsComponentActiveInMask<T>(LayerMask)
Checks if a VolumeComponent is active in a given LayerMask.
Declaration
public bool IsComponentActiveInMask<T>(LayerMask layerMask) where T : VolumeComponent
Parameters
Type | Name | Description |
---|---|---|
LayerMask | layerMask | The LayerMask to check against |
Returns
Type | Description |
---|---|
bool |
|
Type Parameters
Name | Description |
---|---|
T | A type derived from VolumeComponent |
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 |
---|---|---|
VolumeComponent | component | VolumeComponent that has changed. |
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 |
---|---|---|
VolumeProfile | profile | VolumeProfile that has changed. |
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()
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<VolumeProfile> | profiles | List of VolumeProfiles to set as default profiles, or null to clear them. |
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 |
---|---|---|
VolumeProfile | profile | The VolumeProfile to use as the global default profile. |
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 |
---|---|---|
VolumeProfile | profile | The VolumeProfile to use as the quality level default profile. |
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 VolumeStack.
Declaration
public void Update(VolumeStack stack, Transform trigger, LayerMask layerMask)
Parameters
Type | Name | Description |
---|---|---|
VolumeStack | stack | The stack to store the blending result into. |
Transform | trigger | A reference Transform to consider for positional Volume blending. |
LayerMask | 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 |
LayerMask | layerMask | The LayerMask that the Volume manager uses to filter Volumes that it should consider for blending. |