Markup Shader GUI

Overview

Markup Shader GUI makes building shader inspectors as easy as writing HTML.

  • Tag-based syntax: Define layouts, controls, and conditional logic in a clean, readable way.

  • Faster workflow: Less boilerplate, more focus on your shader design.

  • Flexible & powerful: Supports multiple property types, multi-property lines, and conditional visibility.

  • Consistent look: Keep all your shader inspectors neat and uniform.

With Markup Shader GUI, creating complex shader inspectors is simple, structured, and intuitive.

Features

  • Foldout – collapsible section

  • EnableIf – conditional enable

  • ShowIf – conditional visibility

  • Separator – horizontal divider

  • MiniTexture – small texture field

  • MiniTextureWithColor – texture + color in one line

  • FloatRange – improved range slider

  • MultiLineVector – vector displayed in multiple lines

  • Label – text label

  • Tooltip – custom tooltip for properties

Deployment

  • Add a placeholder property at the end of Shader Properties, otherwise MarkupShaderGUI will not work properly.

  • Add CustomEditor "GraphicsCat.MarkupShaderGUI" at the end of the Shader.

Shader "GraphicsCat/MarkupShaderGUI/Example"
{    
    Properties
    {
        ...
        // Add a placeholder property at the end of Shader Properties (any name)
        [HideInInspector] _("", Float) = 0 
    }
    
    SubShader
    {
    }
    
    // Add at the end: CustomEditor "GraphicsCat.MarkupShaderGUI"
    CustomEditor "GraphicsCat.MarkupShaderGUI" 
}

Usage of Tags

Foldout

Syntax:

[BeginFoldout(FoldoutLabel)]
...
[EndFoldout]

Example:

[BeginFoldout(Foldout)] // Foldout label = "Foldout"
    [Toggle]_Prop1("Prop1", Float) = 1
    _Prop2("Prop2", Color) = (1, 1, 1, 1)
[EndFoldout]

EnableIf

Syntax:

[BeginEnableIf(PropName, CompareOperator, Value)]
    ...
[EndEnableIf]

Supported comparison operators: Equal, Less, Greater, LessEqual, GreaterEqual.

Example:

[Toggle(_NORMALMAP)] _NORMALMAP("Normal", Float) = 0
[BeginEnableIf(_NORMALMAP, Equal, 1)] // Enable if _NORMALMAP == 1
    [Normal] _BumpMap("Normal Map", 2D) = "bump" {}
    _BumpScale("Normal Scale", Float) = 1.0
[EndEnableIf]

ShowIf

Syntax:

[BeginShowIf(PropName, CompareOperator, Value)]
    ...
[EndShowIf]

Supported comparison operators: Equal, Less, Greater, LessEqual, GreaterEqual.

Example:

[BeginShowIf(_EMISSION, Equal, 1)] // Shown if _EMISSION == 1
    _EmissionMap("Emission Map", 2D) = "white" {}
    [HDR]_EmissionColor("Emission Color", Color) = (1, 1, 1, 1)
[EndShowIf]

Separator

Syntax:

// properties above
[Separator]
// properties below

Example:

// Property above the separator
[Enum(Off, 0, On, 1)] _PropAbove("Prop Above", Float) = 0 

[Separator]

// Property below the separator
_PropBelow("Prop Below", Color) = (1, 1, 1, 1) 

Label

Syntax:

[Label(Text, Size, Style)]

Supported styles: Normal, Bold, Italic, BoldAndItalic

Example:

[Label(Label Default)]
[Label(Label Size15, 15)]
[Label(Label Size15 Normal, 15, Normal)]
[Label(Label Size15 Bold, 15, Bold)]
[Label(Label Size15 Italic, 15, Italic)]
[Label(Label Size15 BoldAndItalic, 15, BoldAndItalic)]

MiniTexture

Syntax:

[MiniTexture] _TextureProp("TextureName", 2D) = "white" {}

Example:

[MiniTexture] _MiniTexture("MiniTexture", 2D) = "white" {} // Mini texture field

MiniTextureWithColor

Syntax:

[BeginMiniTextureWithColor]
    // Texture field
    // Color field
[EndMiniTextureWithColor]

Example:

[BeginMiniTextureWithColor]
    [MainTexture] _BaseMap("Base Map", 2D) = "white" {} // Texture field
    [MainColor] _BaseColor("Base Color", Color) = (1, 1, 1, 1) // Color field
[EndMiniTextureWithColor]

FloatRange

Syntax:

[FloatRange(0, 1)] _PropName("Prop Display Name", Float) = 0

Example:

[FloatRange(0, 1)] _FloatRange("FloatRange", Float) = 0.5
_Range("UnityRange", Range(0, 1)) = 0.5 // Unity range slider

Note:

FloatRange provides a better slider. Unity's Range slider may disappear when the inspector width is small.

MultiLineVector

Syntax:

[MultiLineVector(count, name1, min1, max1, name2, min2, max2, ...)]
// count: number of components
// "nameX": label for each component (must be a string)
// minX / maxX: min/max values for each component
// Use the 'f' suffix for float values, and 'n' prefix to indicate negative numbers (e.g., n1f = -1.0f)

Example:

[BeginFoldout(MultiLineVector)]
    [MultiLineVector(2, X, 0f, 1f, Y, 0f, 1f)] // 0f represents 0 as a float
    _MultiLineVector2("MultiLineVector2", Float) = 0.5
    [MultiLineVector(3, Top, n1f, 1f, Bottom, n1f, 1f, Left, n1f, 1f, Right, n1f, 1f)] // n1f represents -1 as a float
    _MultiLineVector3("MultiLineVector3", Float) = 0.5
[EndFoldout]

Tooltip

Syntax:

_Prop("Display Name [Tooltip]", ...) = ...

Use square brackets [ ] in the property display name to specify tooltip text.

Example:

// The text inside [ ] is used as a tooltip
_Tooltip("Tooltip [This is Tooltip Text]", Color) = (1, 1, 1, 1) 

Last updated