For information on how a Shader objectAn instance of the Shader class, a Shader object is container for shader programs and GPU instructions, and information that tells Unity how to use them. Use them with materials to determine the appearance of your scene. More info
See in Glossary works, and the relationship between Shader objects, SubShaders and Passes, see Shader objects introduction.
A Shader object is a Unity-specific concept; it is a wrapper for shader programs and other information. It lets you define multiple shader programs in the same file, and tell Unity how to use them.
A Shader object has a nested structure; it organizes information into structures called SubShaders and Passes.
|Built-in Render PipelineA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
See in Glossary
|Universal Render Pipeline (URP)
|High Definition Render Pipeline (HDRP)
|ShaderLab: Shader block
Shader block, you can:
Properties block. See ShaderLab: defining material properties.
SubShader block. See ShaderLab: defining a SubShader.
Fallback block. See ShaderLab: assigning a fallback.
<optional: Material properties>
<One or more SubShader definitions>
<optional: custom editor>
|Defines a Shader object with a given name.
Prior to Unity 5.0, some of the functionality of a shader was determined by its path and name. This is still how Unity’s Legacy Shaders work. Changing the name of these shaders can affect their functionality.
This example code demonstrates the basic syntax and structure of a Shader object. The example Shader object has a single SubShader that contains a single pass. It defines Material properties, a CustomEditor, and a Fallback.
CustomEditor = "ExampleCustomEditor"
// Material property declarations go here
// The code that defines the rest of the SubShader goes here
// The code that defines the Pass goes here
For example custom shaders that are compatible with different render pipelines, see Example custom shaders