The second component of a shader is the SubShader. Each shader is made up of at least one SubShader for the perfect loading of the program. When there is more than one SubShader, Unity will process each of them and take the most suitable according to the hardware characteristics, starting from the first to the last on the list. To understand this, let’s assume that the shader is going to run on hardware that supports metal graph API (iOS). For this, Unity will run the first SubShader that supports metal graphs and run it. When a SubShader is not supported, Unity will try to use the Fallback component that corresponds to a default shader, so the hardware can continue with its task without graphical errors.
Shader “InspectorPath / shaderName”
{
Properties {} …
SubShader
{
// shader configuration here
}
}
If we pay attention to our USB_simple_color shader, the SubShader will appear as follows in its default values:
Shader “USB / USB_simple_color”
{
Properties {} …
SubShader
{
Tags { “RenderType” = “Opaque” }
LOD 100
Pass {} ...
}
}