docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class MaterialEditorExtension

    Provides a set of extension methods for storing, retrieving, and setting expandable states of areas in a MaterialEditor. Additionally, these extensions facilitate handling of various shader property drawers within the editor.

    Inheritance
    object
    MaterialEditorExtension
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor.Rendering
    Assembly: Unity.RenderPipelines.Core.Editor.dll
    Syntax
    public static class MaterialEditorExtension

    Methods

    IntPopupShaderProperty(MaterialEditor, MaterialProperty, string, string[], int[])

    Draw an integer popup selection field for a float shader property.

    Declaration
    public static int IntPopupShaderProperty(this MaterialEditor editor, MaterialProperty prop, string label, string[] displayedOptions, int[] optionValues)
    Parameters
    Type Name Description
    MaterialEditor editor

    MaterialEditor

    MaterialProperty prop

    The MaterialProperty to make a field for

    string label

    Label for the property

    string[] displayedOptions

    An array with the options shown in the popup

    int[] optionValues

    An array with the values for each option

    Returns
    Type Description
    int

    The value of the option that has been selected by the user

    IntShaderProperty(MaterialEditor, MaterialProperty, GUIContent, Func<int, int>)

    Draw an integer property field for a float shader property.

    Declaration
    public static void IntShaderProperty(this MaterialEditor editor, MaterialProperty prop, GUIContent label, Func<int, int> transform = null)
    Parameters
    Type Name Description
    MaterialEditor editor

    MaterialEditor

    MaterialProperty prop

    The MaterialProperty to make a field for

    GUIContent label

    Label for the property

    Func<int, int> transform

    Optional function to apply on the new value

    IntSliderShaderProperty(MaterialEditor, MaterialProperty, int, int, GUIContent)

    Draw an integer slider for a float shader property.

    Declaration
    public static void IntSliderShaderProperty(this MaterialEditor editor, MaterialProperty prop, int min, int max, GUIContent label)
    Parameters
    Type Name Description
    MaterialEditor editor

    MaterialEditor

    MaterialProperty prop

    The MaterialProperty to make a field for

    int min

    The value at the left end of the slider

    int max

    The value at the right end of the slider

    GUIContent label

    Label for the property

    IntSliderShaderProperty(MaterialEditor, MaterialProperty, GUIContent)

    Draw an integer slider for a range shader property.

    Declaration
    public static void IntSliderShaderProperty(this MaterialEditor editor, MaterialProperty prop, GUIContent label)
    Parameters
    Type Name Description
    MaterialEditor editor

    MaterialEditor

    MaterialProperty prop

    The MaterialProperty to make a field for

    GUIContent label

    Label for the property

    MinFloatShaderProperty(MaterialEditor, MaterialProperty, GUIContent, float)

    Draw a property field for a float shader property.

    Declaration
    public static void MinFloatShaderProperty(this MaterialEditor editor, MaterialProperty prop, GUIContent label, float min)
    Parameters
    Type Name Description
    MaterialEditor editor

    MaterialEditor

    MaterialProperty prop

    The MaterialProperty to make a field for

    GUIContent label

    Label for the property

    float min

    The minimum value the user can specify

    MinMaxShaderProperty(MaterialEditor, MaterialProperty, float, float, GUIContent)

    Draw a special slider to specify a range between a min and a max for a vector shader property.

    Declaration
    public static void MinMaxShaderProperty(this MaterialEditor editor, MaterialProperty remapProp, float minLimit, float maxLimit, GUIContent label)
    Parameters
    Type Name Description
    MaterialEditor editor

    MaterialEditor

    MaterialProperty remapProp

    The MaterialProperty containing the range the slider shows in the x and y components of its vectorValue

    float minLimit

    The limit at the left end of the slider

    float maxLimit

    The limit at the right end of the slider

    GUIContent label

    Label for the property

    MinMaxShaderProperty(MaterialEditor, MaterialProperty, MaterialProperty, float, float, GUIContent)

    Draw a special slider to specify a range between a min and a max for two float shader properties.

    Declaration
    public static void MinMaxShaderProperty(this MaterialEditor editor, MaterialProperty min, MaterialProperty max, float minLimit, float maxLimit, GUIContent label)
    Parameters
    Type Name Description
    MaterialEditor editor

    MaterialEditor

    MaterialProperty min

    The MaterialProperty containing the lower value of the range the slider shows

    MaterialProperty max

    The MaterialProperty containing the upper value of the range the slider shows

    float minLimit

    The limit at the left end of the slider

    float maxLimit

    The limit at the right end of the slider

    GUIContent label

    Label for the property

    PopupShaderProperty(MaterialEditor, MaterialProperty, GUIContent, string[])

    Draw a popup selection field for a float shader property.

    Declaration
    public static int PopupShaderProperty(this MaterialEditor editor, MaterialProperty prop, GUIContent label, string[] displayedOptions)
    Parameters
    Type Name Description
    MaterialEditor editor

    MaterialEditor

    MaterialProperty prop

    The MaterialProperty to make a field for

    GUIContent label

    Label for the property

    string[] displayedOptions

    An array with the options shown in the popup

    Returns
    Type Description
    int

    The index of the option that has been selected by the user

    Vector3ShaderProperty(MaterialEditor, MaterialProperty, GUIContent)

    Draw an vector3 field for a vector shader property.

    Declaration
    public static void Vector3ShaderProperty(this MaterialEditor editor, MaterialProperty prop, GUIContent label)
    Parameters
    Type Name Description
    MaterialEditor editor

    MaterialEditor

    MaterialProperty prop

    The MaterialProperty to make a field for

    GUIContent label

    Label for the property

    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)