> For the complete documentation index, see [llms.txt](https://graphicscat.gitbook.io/graphicscat/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://graphicscat.gitbook.io/graphicscat/documentation/markup-shader-gui.md).

# Markup Shader GUI

<figure><img src="/files/StAzlatnsiV4DI19eKZK" alt=""><figcaption></figcaption></figure>

## 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.

<figure><img src="/files/oyTw7nCObjAHcjCrgnpG" alt="" width="464"><figcaption></figcaption></figure>

## Features

* Foldout – Collapsible section
* Separator – Horizontal divider
* EnableIf – Conditional enable
* ShowIf – Conditional visibility
* MiniTexture – Compact texture field
* MiniTextureWithColor – Texture and color in one line
* FloatRange – Enhanced range slider
* MultiLineVector – Vector in multiple lines
* Label – Text label
* Tooltip – Property tooltip
* HelpBox – Message box

<figure><img src="/files/r5ewiunuQt3QvhymcRTn" alt="" width="464"><figcaption></figcaption></figure>

## 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]
```

![](/files/j6cwbRC7PD1ffTsHgdeH)

### 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]
```

![](/files/Kll9TRPrIDsvniJ2RHOc) ![](/files/s395hhwjQHWz7h8IBYgY)

### 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]
```

![](/files/r6POnlshhus7x3N1pmXd) ![](/files/eIgxmU3cpHe5fzemIQw1)

### 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) 
```

![](/files/cQeLcXAWumXUvDPjnTCu)

### 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)]
```

![](/files/9u4haQ5Mi4HJOMEj6OZc)

### MiniTexture

Syntax:

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

Example:

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

![](/files/R9gXcVqBEDL6UOnPIn4d) ![](/files/lyadchnbfjGSIJFQ0CC8)

### 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]
```

![](/files/Mv0qQyrSydgKqOviISUL) ![](/files/bFlwEKJmIIccE9VW1WDK)

### 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
```

![](/files/ikdLlIfoJVaFMEEHbZBX)

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", Vector) = (1, 1, 1, 1)
    [MultiLineVector(3, Top, n1f, 1f, Bottom, n1f, 1f, Left, n1f, 1f, Right, n1f, 1f)] // n1f represents -1 as a float
    _MultiLineVector3("MultiLineVector3", Vector) = (1, 1, 1, 1)
[EndFoldout]
```

![](/files/uIuvbvMI1CENPpbcg2lW)

### 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) 
```

![](/files/QdXFzANYgOcgK0or3G1c)

### HelpBox

Syntax:

```
[HelpBox] _Prop("Message", Float) = 0
```

Example:

```
[HelpBox] _NeutralHelpBox("This is a neutral message.", Float) = 0
[HelpBox(Info)] _InfoHelpBox("This is an info message.", Float) = 0
[HelpBox(Warning)] _WarningHelpBox("This is a warning message.", Float) = 0
[HelpBox(Error)] _ErrorHelpBox("This is an error message.", Float) = 0
```

![](/files/z0JJPwIh5TGLhufzyXdz)

## Enjoying this package? <a href="#hkme-1756996710213" id="hkme-1756996710213"></a>

* Give it a quick rating or leave a short review on the Unity Asset Store.
* Your feedback helps us improve and add even more features!
* [Review on Unity Asset Store](https://assetstore.unity.com/packages/slug/333818)
