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

Introduction to the shader programming language

3.0.2. ShaderLab Shader

This post is also available in…

Most of our shaders written in code will start with the declaration of the Shader, then its path in the Unity Inspector and finally the name that we assign to it (e.g. Shader “shader inspector path/shader name”).

Both the properties such as the SubShader and the Fallback are written inside the “Shader” field in ShaderLab declarative language.

Shader “InspectorPath / shaderName”
{
    // Write ShaderLab code here 
}

Since USB_simple_color has been declared as “Unlit/USB_simple_color” by default, if we want to assign it to a material, then we will have to go to the Unity Inspector, look for the Unlit path and then select “USB_simple_color”.

Both the path and the name of the shader can be changed as needed by the project organisation.

// default value
Shader “Unlit / USB_simple_color”        
{
    // write ShaderLab code here 
}

// customized path to USB (Unity Shader Bible)
Shader “USB / USB_simple_color”    
{
    // write ShaderLab code here 
}

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-logo

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.