docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class BaseShaderGUI

    The base class for shader GUI in URP.

    Inheritance
    object
    ShaderGUI
    BaseShaderGUI
    Inherited Members
    ShaderGUI.OnMaterialPreviewGUI(MaterialEditor, Rect, GUIStyle)
    ShaderGUI.OnMaterialInteractivePreviewGUI(MaterialEditor, Rect, GUIStyle)
    ShaderGUI.OnMaterialPreviewSettingsGUI(MaterialEditor)
    ShaderGUI.OnClosed(Material)
    ShaderGUI.ValidateMaterial(Material)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor
    Assembly: Unity.RenderPipelines.Universal.Editor.dll
    Syntax
    public abstract class BaseShaderGUI : ShaderGUI

    Fields

    m_FirstTimeApply

    Used to sure that needed setup (ie keywords/render queue) are set up when switching some existing material to a universal shader.

    Declaration
    public bool m_FirstTimeApply
    Field Value
    Type Description
    bool

    Properties

    addPrecomputedVelocityProp

    The MaterialProperty for pre-computed motion vectors (for Alembic).

    Declaration
    protected MaterialProperty addPrecomputedVelocityProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    alphaClipProp

    The MaterialProperty for alpha clip.

    Declaration
    protected MaterialProperty alphaClipProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    alphaCutoffProp

    The MaterialProperty for alpha cutoff.

    Declaration
    protected MaterialProperty alphaCutoffProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    baseColorProp

    The MaterialProperty for base color.

    Declaration
    protected MaterialProperty baseColorProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    baseMapProp

    The MaterialProperty for base map.

    Declaration
    protected MaterialProperty baseMapProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    blendModeProp

    The MaterialProperty for the blend mode.

    Declaration
    protected MaterialProperty blendModeProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    castShadowsProp

    The MaterialProperty for cast shadows.

    Declaration
    protected MaterialProperty castShadowsProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    cullingProp

    The MaterialProperty for cull mode.

    Declaration
    protected MaterialProperty cullingProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    emissionColorProp

    The MaterialProperty for emission color.

    Declaration
    protected MaterialProperty emissionColorProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    emissionMapProp

    The MaterialProperty for emission map.

    Declaration
    protected MaterialProperty emissionMapProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    materialEditor

    The editor for the material.

    Declaration
    protected MaterialEditor materialEditor { get; set; }
    Property Value
    Type Description
    MaterialEditor

    materialFilter

    Filter for the surface options, surface inputs, details and advanced foldouts.

    Declaration
    protected virtual uint materialFilter { get; }
    Property Value
    Type Description
    uint

    preserveSpecProp

    The MaterialProperty for preserve specular.

    Declaration
    protected MaterialProperty preserveSpecProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    queueControlProp

    The MaterialProperty for queue control.

    Declaration
    protected MaterialProperty queueControlProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    queueOffsetProp

    The MaterialProperty for queue offset.

    Declaration
    protected MaterialProperty queueOffsetProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    receiveShadowsProp

    The MaterialProperty for receive shadows.

    Declaration
    protected MaterialProperty receiveShadowsProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    surfaceTypeProp

    The MaterialProperty for surface type.

    Declaration
    protected MaterialProperty surfaceTypeProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    ztestProp

    The MaterialProperty for zTest.

    Declaration
    protected MaterialProperty ztestProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    zwriteProp

    The MaterialProperty for zWrite.

    Declaration
    protected MaterialProperty zwriteProp { get; set; }
    Property Value
    Type Description
    MaterialProperty

    Methods

    AssignNewShaderToMaterial(Material, Shader, Shader)

    Assigns a new shader to the material.

    Declaration
    public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
    Parameters
    Type Name Description
    Material material

    The material to use.

    Shader oldShader

    The old shader.

    Shader newShader

    The new shader to replace.

    Overrides
    ShaderGUI.AssignNewShaderToMaterial(Material, Shader, Shader)

    DoPopup(GUIContent, MaterialProperty, string[])

    Helper function to draw a popup.

    Declaration
    public void DoPopup(GUIContent label, MaterialProperty property, string[] options)
    Parameters
    Type Name Description
    GUIContent label

    The label to use.

    MaterialProperty property

    The property to display.

    string[] options

    The options available.

    DrawAdvancedOptions(Material)

    Draws the advanced options GUI.

    Declaration
    public virtual void DrawAdvancedOptions(Material material)
    Parameters
    Type Name Description
    Material material

    The material to use.

    DrawBaseProperties(Material)

    Draws the base properties GUI.

    Declaration
    public virtual void DrawBaseProperties(Material material)
    Parameters
    Type Name Description
    Material material

    The material to use.

    DrawEmissionProperties(Material, bool)

    Draws the emission properties.

    Declaration
    protected virtual void DrawEmissionProperties(Material material, bool keyword)
    Parameters
    Type Name Description
    Material material

    The material to use.

    bool keyword

    The keyword used for emission.

    DrawNormalArea(MaterialEditor, MaterialProperty, MaterialProperty)

    Draws the GUI for the normal area.

    Declaration
    public static void DrawNormalArea(MaterialEditor materialEditor, MaterialProperty bumpMap, MaterialProperty bumpMapScale = null)
    Parameters
    Type Name Description
    MaterialEditor materialEditor

    The material editor to use.

    MaterialProperty bumpMap

    The normal map property.

    MaterialProperty bumpMapScale

    The normal map scale property.

    DrawQueueOffsetField()

    Draws the queue offset field.

    Declaration
    protected void DrawQueueOffsetField()

    DrawSurfaceInputs(Material)

    Draws the surface inputs GUI.

    Declaration
    public virtual void DrawSurfaceInputs(Material material)
    Parameters
    Type Name Description
    Material material

    The material to use.

    DrawSurfaceOptions(Material)

    Draws the surface options GUI.

    Declaration
    public virtual void DrawSurfaceOptions(Material material)
    Parameters
    Type Name Description
    Material material

    The material to use.

    DrawTileOffset(MaterialEditor, MaterialProperty)

    Draws the tile offset GUI.

    Declaration
    protected static void DrawTileOffset(MaterialEditor materialEditor, MaterialProperty textureProp)
    Parameters
    Type Name Description
    MaterialEditor materialEditor

    The material editor to use.

    MaterialProperty textureProp

    The texture property.

    FillAdditionalFoldouts(MaterialHeaderScopeList)

    Draws additional foldouts.

    Declaration
    public virtual void FillAdditionalFoldouts(MaterialHeaderScopeList materialScopesList)
    Parameters
    Type Name Description
    MaterialHeaderScopeList materialScopesList

    FindProperties(MaterialProperty[])

    Finds all the properties used in the Base Shader GUI.

    Declaration
    public virtual void FindProperties(MaterialProperty[] properties)
    Parameters
    Type Name Description
    MaterialProperty[] properties

    Array of properties to search in.

    FindProperty(string, MaterialProperty[])

    Searches and tries to find a property in an array of properties.

    Declaration
    public static MaterialProperty FindProperty(string propertyName, MaterialProperty[] properties)
    Parameters
    Type Name Description
    string propertyName

    The property to find.

    MaterialProperty[] properties

    Array of properties to search in.

    Returns
    Type Description
    MaterialProperty

    A MaterialProperty instance for the property.

    FindProperty(string, MaterialProperty[], bool)

    Searches and tries to find a property in an array of properties.

    Declaration
    public static MaterialProperty FindProperty(string propertyName, MaterialProperty[] properties, bool propertyIsMandatory)
    Parameters
    Type Name Description
    string propertyName

    The property to find.

    MaterialProperty[] properties

    Array of properties to search in.

    bool propertyIsMandatory

    Should throw exception if property is not found

    Returns
    Type Description
    MaterialProperty

    A MaterialProperty instance for the property.

    Exceptions
    Type Condition
    ArgumentException

    OnGUI(MaterialEditor, MaterialProperty[])

    Declaration
    public override void OnGUI(MaterialEditor materialEditorIn, MaterialProperty[] properties)
    Parameters
    Type Name Description
    MaterialEditor materialEditorIn
    MaterialProperty[] properties
    Overrides
    ShaderGUI.OnGUI(MaterialEditor, MaterialProperty[])

    OnOpenGUI(Material, MaterialEditor)

    Draws the GUI for the material.

    Declaration
    public virtual void OnOpenGUI(Material material, MaterialEditor materialEditor)
    Parameters
    Type Name Description
    Material material

    The material to use.

    MaterialEditor materialEditor

    The material editor to use.

    SetMaterialKeywords(Material, Action<Material>, Action<Material>)

    Sets up the keywords for the material and shader.

    Declaration
    public static void SetMaterialKeywords(Material material, Action<Material> shadingModelFunc = null, Action<Material> shaderFunc = null)
    Parameters
    Type Name Description
    Material material

    The material to use.

    Action<Material> shadingModelFunc

    Function to set shading models.

    Action<Material> shaderFunc

    Function to set some extra shader parameters.

    SetupMaterialBlendMode(Material)

    Sets up the blend mode.

    Declaration
    public static void SetupMaterialBlendMode(Material material)
    Parameters
    Type Name Description
    Material material

    The material to use.

    ShaderPropertiesGUI(Material)

    Draws the shader properties GUI.

    Declaration
    public void ShaderPropertiesGUI(Material material)
    Parameters
    Type Name Description
    Material material

    The material to use.

    TextureColorProps(MaterialEditor, GUIContent, MaterialProperty, MaterialProperty, bool)

    Helper function to show texture and color properties.

    Declaration
    public static Rect TextureColorProps(MaterialEditor materialEditor, GUIContent label, MaterialProperty textureProp, MaterialProperty colorProp, bool hdr = false)
    Parameters
    Type Name Description
    MaterialEditor materialEditor

    The material editor to use.

    GUIContent label

    The label to use.

    MaterialProperty textureProp

    The texture property.

    MaterialProperty colorProp

    The color property.

    bool hdr

    Marks whether this is a HDR texture or not.

    Returns
    Type Description
    Rect

    TwoFloatSingleLine(GUIContent, MaterialProperty, GUIContent, MaterialProperty, GUIContent, MaterialEditor, float)

    Helper function to draw two float variables in one lines.

    Declaration
    public static void TwoFloatSingleLine(GUIContent title, MaterialProperty prop1, GUIContent prop1Label, MaterialProperty prop2, GUIContent prop2Label, MaterialEditor materialEditor, float labelWidth = 30)
    Parameters
    Type Name Description
    GUIContent title

    The title to use.

    MaterialProperty prop1

    The property for the first float.

    GUIContent prop1Label

    The label for the first float.

    MaterialProperty prop2

    The property for the second float.

    GUIContent prop2Label

    The label for the second float.

    MaterialEditor materialEditor

    The material editor to use.

    float labelWidth

    The width of the labels.

    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)