Shader block in ShaderLab reference
Reference for the Shader block in ShaderLab.
Read time 1 minuteLast updated a month ago
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.
Inside the block, you can:
Shader- Define material properties, using the block. See ShaderLab: defining material properties.
Properties - Define one or more SubShaders, using the block. See ShaderLab: defining a SubShader.
SubShader - Assign a custom editor, which determines how the shader asset appears in the Unity Editor. Optionally, you can assign different custom editors for different render pipelines. See ShaderLab: assigning custom editors.
- Assign a fallback Shader object, using the block. See ShaderLab: assigning a fallback.
Fallback
Render pipeline compatibility
Feature name | Universal Render Pipeline (URP) | High Definition Render Pipeline (HDRP) | Custom SRP | Built-in Render Pipeline |
|---|---|---|---|---|
| ShaderLab: Shader block | Yes | Yes | Yes | Yes |
Syntax
Signature | Function |
|---|---|
| Defines a Shader object with a given name. |