Get an 20% OFF using the RELEASE code on your book purchase. For a limited time.

Introduction to the shader programming language

3.1.2. MPD Space and Header

This post is also available in…

Finally, these drawers help a lot in organization tasks. 

“Space” allows us to add space between one property and another. If we wish that our properties appear separate in the material inspector we can add space between them. 

Its syntax is as follows:

_PropertyName01 ("Display name", Float ) = 0
// we add the space 
_PropertyName02 ("Display name", Float ) = 0

In this case, we are adding ten points of space between the property _PropertyName01 and the property _PropertyName02. Equally, as its name says, “Header” adds a header in the Unity Inspector. This is very useful when generating categories in our properties. 

Its syntax is as follows:

// we add the header
[Header(Category name)]
_PropertyName01 ("Display name", Float ) = 0
_PropertyName02 ("Display name", Float ) = 0

In this example, we have added a small header before starting our properties, which will be visible in the Inspector. To understand both properties we will perform the following operation:

Shader “InspectorPath / shaderName”
        [Header(Specular properties)]
        _Specularity (“Speculatrity", Range (0.01, 1)) = 0.08
        _Brightness (“Brightness", Range (0.01, 1)) = 0.08
        _SpecularColor (“Specular Color”, Color) = (1, 1, 1 , 1)
        [Header(Texture properties)]
        _MainTex (“Texture”, 2D) = “white” {}
    SubShader {} ...

Follow us to stay informed about all the latest news, updates, and more.

Join the group to share your experiences with other developers.

Subscribe to our channel and keep learning game dev!


Jettelly Team

We are a team of indie developers with more than 9 years of experience in video games. As an independent studio, we have developed Nom Noms in which we published with Hyperbeard in 2019. We are currently developing The Unity Shader Bible.

Follow us on our social networks.