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

Introduction to the shader programming language

3.0.7. Material Property Drawer

This post is also available in…

Another type of property that we can find in ShaderLab are “drawers”. This class allows us to generate custom properties in the Unity Inspector, thus facilitating the programming of conditionals in the shader.

By default, this type of property is not included in our shader, instead, we have to declare them according to our needs. To date, there are seven different drawers:

  • Toggle.
  • Enum.
  • KeywordEnum.
  • PowerSlider.
  • IntRange.
  • Space.
  • Header.

Each one of them has a specific function and is declared independently.

Thanks to these properties we can generate multiple states within our program, allowing the creation of dynamic effects without the need to change materials at execution time. We generally use these drawers together with two types of shader variants, these refer to #pragma multi_compile and #pragma shader_feature.

(Fig. 022)

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.