# Markup Shader GUI

<figure><img src="https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2FoMZTOChXxfdKBcTYjEJW%2FMarkupShaderGUI%20-%20Cover%201950x1300.png?alt=media&#x26;token=9efe87f2-fe35-4c30-b1a8-1dd05ee50c69" 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="https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2FeKXgbtFlLgffmdFV0IER%2FSnipaste_2025-09-15_22-01-20.png?alt=media&#x26;token=094d7f35-835a-40e1-a616-bb961587f8e3" 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="https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2FIPI9FhrN1zt22OivHiwt%2FSnipaste_2025-09-15_21-54-53.png?alt=media&#x26;token=dd52adcb-1672-47b0-8027-147044b76945" 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]
```

![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2F7rcehiC3Bs6QHXoqBEIp%2F0.png?alt=media)

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

![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2F8zEFyUcUhFhp2iOSHM0w%2F1.png?alt=media) ![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2F7MCmxScaCMk3vmMINEAO%2F2.png?alt=media)

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

![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2Fs15D1WlOCcDA8lM7dYzE%2F3.png?alt=media) ![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2FhimURY7tdUVOpe7v77vT%2F4.png?alt=media)

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

![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2FuzNgj0wELEyueLH9plup%2F5.png?alt=media)

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

![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2FWgCzeurQykEPCvRf9rVi%2F6.png?alt=media)

### MiniTexture

Syntax:

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

Example:

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

![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2FnEhSSMPD39kQW0stbKrj%2F7.png?alt=media) ![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2FDaSinBCFIpzBHuzIubMD%2F8.png?alt=media)

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

![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2FyEsTIRlenHNd6dSCZ7wE%2F9.png?alt=media) ![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2FeYozBUBg6FZLUISbbsOt%2F10.png?alt=media)

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

![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2F1JWeNzewGVcHAKvehcVO%2F11.png?alt=media)

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

![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2F6beEinAeV17ygsm3ejlS%2F12.png?alt=media)

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

![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2FgVlKTCUtAL9gy58Rzxqh%2F13.png?alt=media)

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

![](https://1015306288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5TKI5zdwMx1bXFiVnBUe%2Fuploads%2F3GVoJXbMHN1oBVsK0RNP%2Fhelpbox.png?alt=media\&token=0c0bac40-47cd-4a81-93ab-c594d0a307d3)

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://graphicscat.gitbook.io/graphicscat/documentation/markup-shader-gui.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
