docs.unity3d.com
    Show / Hide Table of Contents

    Class HDShaderGUI

    Use this class to build your custom Shader GUI for HDRP. You can use a class that inherits from HDShaderGUI in the Shader Graph Custom EditorGUI field.

    Inheritance
    Object
    ShaderGUI
    HDShaderGUI
    DecalShaderGraphGUI
    LightingShaderGraphGUI
    UnlitShaderGraphGUI
    Inherited Members
    ShaderGUI.OnMaterialPreviewGUI(MaterialEditor, Rect, GUIStyle)
    UnityEditor.ShaderGUI.OnMaterialInteractivePreviewGUI(UnityEditor.MaterialEditor, UnityEngine.Rect, UnityEngine.GUIStyle)
    ShaderGUI.OnMaterialPreviewSettingsGUI(MaterialEditor)
    ShaderGUI.OnClosed(Material)
    ShaderGUI.FindProperty(String, MaterialProperty[])
    ShaderGUI.FindProperty(String, MaterialProperty[], Boolean)
    Namespace: UnityEditor.Rendering.HighDefinition
    Syntax
    public abstract class HDShaderGUI : ShaderGUI

    Fields

    m_FirstFrame

    Declaration
    protected bool m_FirstFrame
    Field Value
    Type Description
    Boolean

    Methods

    ApplyKeywordsAndPassesIfNeeded(Boolean, Material[])

    Sets up the keywords and passes for the material. You must call this function after you change a property on a material to ensure it's validity.

    Declaration
    protected void ApplyKeywordsAndPassesIfNeeded(bool changed, Material[] materials)
    Parameters
    Type Name Description
    Boolean changed

    GUI.changed is the usual value for this parameter. If this value is false, the function just exits.

    Material[] materials

    The materials to perform the setup on.

    AssignNewShaderToMaterial(Material, Shader, Shader)

    Unity calls this function when you assign a new shader to the material.

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

    The current material.

    Shader oldShader

    The shader the material currently uses.

    Shader newShader

    The new shader to assign to the material.

    Overrides
    ShaderGUI.AssignNewShaderToMaterial(Material, Shader, Shader)

    OnGUI(MaterialEditor, MaterialProperty[])

    Unity calls this function when it displays the GUI. This method is sealed so you cannot override it. To implement your custom GUI, use OnMaterialGUI instead.

    Declaration
    public override sealed void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
    Parameters
    Type Name Description
    MaterialEditor materialEditor

    Material editor instance.

    MaterialProperty[] props

    The list of properties in the inspected material(s).

    Overrides
    ShaderGUI.OnGUI(MaterialEditor, MaterialProperty[])

    OnMaterialGUI(MaterialEditor, MaterialProperty[])

    Implement your custom GUI in this function. To display a UI similar to HDRP shaders, use a MaterialUIBlockList.

    Declaration
    protected abstract void OnMaterialGUI(MaterialEditor materialEditor, MaterialProperty[] props)
    Parameters
    Type Name Description
    MaterialEditor materialEditor

    The current material editor.

    MaterialProperty[] props

    The list of properties in the inspected material(s).

    SetupMaterialKeywordsAndPass(Material)

    Sets up the keywords and passes for the material you pass in as a parameter.

    Declaration
    protected abstract void SetupMaterialKeywordsAndPass(Material material)
    Parameters
    Type Name Description
    Material material

    Target material.

    SynchronizeShaderGraphProperties(Material)

    Synchronize a set of properties that Unity requires for Shader Graph materials to work correctly. This function is for Shader Graph only.

    Declaration
    protected static void SynchronizeShaderGraphProperties(Material material)
    Parameters
    Type Name Description
    Material material

    The target material.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023