docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class VolumeComponent

    The base class for all the components that can be part of a VolumeProfile. The Volume framework automatically handles and interpolates any VolumeParameter members found in this class.

    Inheritance
    object
    Object
    ScriptableObject
    VolumeComponent
    ProbeVolumesOptions
    Implements
    IApplyRevertPropertyContextMenuItemProvider
    Inherited Members
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(string)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    Object.GetInstanceID()
    Object.Equals(object)
    Object.InstantiateAsync<T>(T)
    Object.InstantiateAsync<T>(T, Transform)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int)
    Object.InstantiateAsync<T>(T, int, Transform)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, CancellationToken)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Scene)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.Rendering
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    Syntax
    [Serializable]
    public class VolumeComponent : ScriptableObject, IApplyRevertPropertyContextMenuItemProvider
    Examples
    using UnityEngine.Rendering;
    
    [Serializable, VolumeComponentMenuForRenderPipeline("Custom/Example Component")]
    public class ExampleComponent : VolumeComponent
    {
        public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f);
    }

    Fields

    active

    The active state of the set of parameters defined in this class. You can use this to quickly turn on or off all the overrides at once.

    Declaration
    public bool active
    Field Value
    Type Description
    bool

    Properties

    displayName

    The name displayed in the component header. If you do not set a name, Unity generates one from the class name automatically.

    Declaration
    public string displayName { get; protected set; }
    Property Value
    Type Description
    string

    parameters

    A read-only collection of all the VolumeParameters defined in this class.

    Declaration
    public ReadOnlyCollection<VolumeParameter> parameters { get; }
    Property Value
    Type Description
    ReadOnlyCollection<VolumeParameter>

    Methods

    AnyPropertiesIsOverridden()

    Returns true if any of the volume properites has been overridden.

    Declaration
    public bool AnyPropertiesIsOverridden()
    Returns
    Type Description
    bool

    True if any of the volume properites has been overridden.

    GetHashCode()

    A custom hashing function that Unity uses to compare the state of parameters.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A computed hash code for the current instance.

    Overrides
    UnityEngine.Object.GetHashCode()

    GetSourceName(Component)

    Declaration
    public string GetSourceName(Component comp)
    Parameters
    Type Name Description
    Component comp
    Returns
    Type Description
    string

    GetSourceTerm()

    Declaration
    public string GetSourceTerm()
    Returns
    Type Description
    string

    OnDestroy()

    Unity calls this method before the object is destroyed.

    Declaration
    protected virtual void OnDestroy()

    OnDisable()

    Unity calls this method when the object goes out of scope.

    Declaration
    protected virtual void OnDisable()

    OnEnable()

    Unity calls this method when it loads the class.

    Declaration
    protected virtual void OnEnable()
    Remarks

    If you want to override this method, you must call base.OnEnable().

    Override(VolumeComponent, float)

    Interpolates a VolumeComponent with this component by an interpolation factor and puts the result back into the given VolumeComponent.

    Declaration
    public virtual void Override(VolumeComponent state, float interpFactor)
    Parameters
    Type Name Description
    VolumeComponent state

    The internal component to interpolate from. You must store the result of the interpolation in this same component.

    float interpFactor

    The interpolation factor in range [0,1].

    Remarks

    You can override this method to do your own blending. Either loop through the parameters list or reference direct fields. You should only use SetValue(VolumeParameter) to set parameter values and not assign directly to the state object. you should also manually check overrideState before you set any values.

    Examples

    Below is the default implementation for blending:

    public virtual void Override(VolumeComponent state, float interpFactor)
    {
        int count = parameters.Count;
    
    for (int i = 0; i < count; i++)
    {
        var stateParam = state.parameters[i];
        var toParam = parameters[i];
    
        if (toParam.overrideState)
        {
            // Keep track of the override state to ensure that state will be reset on next frame (and for debugging purpose)
            stateParam.overrideState = toParam.overrideState;
            stateParam.Interp(stateParam, toParam, interpFactor);
        }
    }
    

    }

    Release()

    Releases all the allocated resources.

    Declaration
    public void Release()

    SetAllOverridesTo(bool)

    Sets the state of all the overrides on this component to a given value.

    Declaration
    public void SetAllOverridesTo(bool state)
    Parameters
    Type Name Description
    bool state

    The value to set the state of the overrides to.

    TryGetApplyMethodForFieldName(SerializedProperty, out Action<SerializedProperty>)

    Declaration
    public bool TryGetApplyMethodForFieldName(SerializedProperty property, out Action<SerializedProperty> applyMethod)
    Parameters
    Type Name Description
    SerializedProperty property
    Action<SerializedProperty> applyMethod
    Returns
    Type Description
    bool

    TryGetRevertMethodForFieldName(SerializedProperty, out Action<SerializedProperty>)

    Declaration
    public bool TryGetRevertMethodForFieldName(SerializedProperty property, out Action<SerializedProperty> revertMethod)
    Parameters
    Type Name Description
    SerializedProperty property
    Action<SerializedProperty> revertMethod
    Returns
    Type Description
    bool

    Implements

    IApplyRevertPropertyContextMenuItemProvider

    Extension Methods

    ReflectionUtils.GetField(object, string)
    ReflectionUtils.GetFields(object)
    ReflectionUtils.Invoke(object, string, params object[])
    ReflectionUtils.SetField(object, string, object)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, T)
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)