docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class VolumeComponentEditor

    A custom editor class that draws a VolumeComponent in the Inspector. If you do not provide a custom editor for a VolumeComponent, Unity uses the default one. You must use a CustomEditor to let the editor know which component this drawer is for.

    Inheritance
    object
    Object
    ScriptableObject
    Editor
    VolumeComponentEditor
    Inherited Members
    Editor.SaveChanges()
    Editor.DiscardChanges()
    Editor.CreateEditorWithContext(Object[], Object, Type)
    Editor.CreateEditorWithContext(Object[], Object)
    Editor.CreateCachedEditorWithContext(Object, Object, Type, ref Editor)
    Editor.CreateCachedEditorWithContext(Object[], Object, Type, ref Editor)
    Editor.CreateCachedEditor(Object, Type, ref Editor)
    Editor.CreateCachedEditor(Object[], Type, ref Editor)
    Editor.CreateEditor(Object)
    Editor.CreateEditor(Object, Type)
    Editor.CreateEditor(Object[])
    Editor.CreateEditor(Object[], Type)
    Editor.DrawPropertiesExcluding(SerializedObject, params string[])
    Editor.DrawDefaultInspector()
    Editor.CreateInspectorGUI()
    Editor.RequiresConstantRepaint()
    Editor.DrawHeader()
    Editor.OnHeaderGUI()
    Editor.ShouldHideOpenButton()
    Editor.DrawFoldoutInspector(Object, ref Editor)
    Editor.HasPreviewGUI()
    Editor.CreatePreview(VisualElement)
    Editor.GetPreviewTitle()
    Editor.RenderStaticPreview(string, Object[], int, int)
    Editor.OnPreviewGUI(Rect, GUIStyle)
    Editor.OnInteractivePreviewGUI(Rect, GUIStyle)
    Editor.OnPreviewSettings()
    Editor.GetInfoString()
    Editor.DrawPreview(Rect)
    Editor.ReloadPreviewInstances()
    Editor.UseDefaultMargins()
    Editor.MoveNextTarget()
    Editor.ResetTarget()
    Editor.hasUnsavedChanges
    Editor.saveChangesMessage
    Editor.target
    Editor.targets
    Editor.serializedObject
    Editor.finishedDefaultHeaderGUI
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(string)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    Object.GetInstanceID()
    Object.GetHashCode()
    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: UnityEditor.Rendering
    Assembly: Unity.RenderPipelines.Core.Editor.dll
    Syntax
    [CustomEditor(typeof(VolumeComponent), true)]
    public class VolumeComponentEditor : Editor
    Examples

    Below is an example of a custom VolumeComponent:

    using UnityEngine.Rendering;
    

    [Serializable, VolumeComponentMenu("Custom/Example Component")] public class ExampleComponent : VolumeComponent { public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f); }

    And its associated editor:

    using UnityEditor.Rendering;
    

    [CustomEditor(typeof(ExampleComponent))] class ExampleComponentEditor : VolumeComponentEditor { SerializedDataParameter m_Intensity;

    public override void OnEnable()
    {
        var o = new PropertyFetcher<ExampleComponent>(serializedObject);
        m_Intensity = Unpack(o.Find(x => x.intensity));
    }
    
    public override void OnInspectorGUI()
    {
        PropertyField(m_Intensity);
    }
    

    }

    Fields

    m_Inspector

    A reference to the parent editor in the Inspector.

    Declaration
    protected Editor m_Inspector
    Field Value
    Type Description
    Editor
    See Also
    CustomEditor

    Properties

    activeProperty

    The serialized property of active for the component being inspected.

    Declaration
    public SerializedProperty activeProperty { get; }
    Property Value
    Type Description
    SerializedProperty
    See Also
    CustomEditor

    baseProperty

    The copy of the serialized property of the VolumeComponent being inspected. Unity uses this to track whether the editor is collapsed in the Inspector or not.

    Declaration
    [Obsolete("Please use expanded property instead. #from(2022.2)", false)]
    public SerializedProperty baseProperty { get; }
    Property Value
    Type Description
    SerializedProperty
    See Also
    CustomEditor

    enableOverrides

    Whether to draw the UI elements related to overrides.

    Declaration
    public bool enableOverrides { get; set; }
    Property Value
    Type Description
    bool
    See Also
    CustomEditor

    expanded

    If the editor for this VolumeComponent is expanded or not in the inspector

    Declaration
    public bool expanded { get; set; }
    Property Value
    Type Description
    bool
    See Also
    CustomEditor

    hasAdditionalProperties

    Override this property if your editor makes use of the "Additional Properties" feature.

    Declaration
    public virtual bool hasAdditionalProperties { get; }
    Property Value
    Type Description
    bool
    See Also
    CustomEditor

    showAdditionalProperties

    Set to true to show additional properties.

    Declaration
    public bool showAdditionalProperties { get; set; }
    Property Value
    Type Description
    bool
    See Also
    CustomEditor

    volume

    Obtains the Volume that is being edited if editing a scene volume, otherwise null.

    Declaration
    protected Volume volume { get; }
    Property Value
    Type Description
    Volume
    See Also
    CustomEditor

    volumeComponent

    Specifies the VolumeComponent this editor is drawing.

    Declaration
    public VolumeComponent volumeComponent { get; }
    Property Value
    Type Description
    VolumeComponent
    See Also
    CustomEditor

    Methods

    BeginAdditionalPropertiesScope()

    Start a scope for additional properties. This will handle the highlight of the background when toggled on and off.

    Declaration
    protected bool BeginAdditionalPropertiesScope()
    Returns
    Type Description
    bool

    True if the additional content should be drawn.

    See Also
    CustomEditor

    ColorFieldLinear(SerializedDataParameter)

    Draw a Color Field but convert the color to gamma space before displaying it in the shader. Using SetColor on a material does the conversion, but setting the color as vector3 in a constant buffer doesn't So we have to do it manually, doing it in the UI avoids having to do a migration step for existing fields

    Declaration
    protected void ColorFieldLinear(SerializedDataParameter property)
    Parameters
    Type Name Description
    SerializedDataParameter property

    The color property

    See Also
    CustomEditor

    DrawHeader(string)

    Draws a header into the inspector with the given title

    Declaration
    protected void DrawHeader(string header)
    Parameters
    Type Name Description
    string header

    The title for the header

    See Also
    CustomEditor

    DrawOverrideCheckbox(SerializedDataParameter)

    Draws the override checkbox used by a property in the editor.

    Declaration
    protected void DrawOverrideCheckbox(SerializedDataParameter property)
    Parameters
    Type Name Description
    SerializedDataParameter property

    The property to draw the override checkbox for

    See Also
    CustomEditor

    EndAdditionalPropertiesScope()

    End a scope for additional properties.

    Declaration
    protected void EndAdditionalPropertiesScope()
    See Also
    CustomEditor

    GetDisplayTitle()

    Sets the label for the component header. Override this method to provide a custom label. If you don't, Unity automatically obtains one from the class name.

    Declaration
    public virtual GUIContent GetDisplayTitle()
    Returns
    Type Description
    GUIContent

    A label to display in the component header.

    See Also
    CustomEditor

    OnBeforeInspectorGUI()

    Unity calls this method after drawing the header for each VolumeComponentEditor

    Declaration
    protected virtual void OnBeforeInspectorGUI()
    See Also
    CustomEditor

    OnDisable()

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

    Declaration
    public virtual void OnDisable()
    See Also
    CustomEditor

    OnEnable()

    Unity calls this method when the object loads.

    Declaration
    public virtual void OnEnable()
    Remarks

    You can safely override this method and not call base.OnEnable() unless you want Unity to display all the properties from the VolumeComponent automatically.

    See Also
    CustomEditor

    OnInspectorGUI()

    Unity calls this method each time it re-draws the Inspector.

    Declaration
    public override void OnInspectorGUI()
    Overrides
    Editor.OnInspectorGUI()
    Remarks

    You can safely override this method and not call base.OnInspectorGUI() unless you want Unity to display all the properties from the VolumeComponent automatically.

    See Also
    CustomEditor

    PropertyField(SerializedDataParameter)

    Draws a given SerializedDataParameter in the editor.

    Declaration
    protected bool PropertyField(SerializedDataParameter property)
    Parameters
    Type Name Description
    SerializedDataParameter property

    The property to draw in the editor

    Returns
    Type Description
    bool

    true if the property field has been rendered

    See Also
    CustomEditor

    PropertyField(SerializedDataParameter, GUIContent)

    Draws a given SerializedDataParameter in the editor using a custom label and tooltip.

    Declaration
    protected bool PropertyField(SerializedDataParameter property, GUIContent title)
    Parameters
    Type Name Description
    SerializedDataParameter property

    The property to draw in the editor.

    GUIContent title

    A custom label and/or tooltip.

    Returns
    Type Description
    bool

    true if the property field has been rendered

    See Also
    CustomEditor

    Repaint()

    Triggers an Inspector repaint event.

    Declaration
    public void Repaint()
    See Also
    CustomEditor

    Unpack(SerializedProperty)

    Generates and auto-populates a SerializedDataParameter from a serialized VolumeParameter<T>.

    Declaration
    protected SerializedDataParameter Unpack(SerializedProperty property)
    Parameters
    Type Name Description
    SerializedProperty property

    A serialized property holding a VolumeParameter<T>

    Returns
    Type Description
    SerializedDataParameter

    A SerializedDataParameter that encapsulates the provided serialized property.

    See Also
    CustomEditor

    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)

    See Also

    CustomEditor
    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)