Legacy Documentation: Version 4.6.2
Language: English
ShaderLab syntax: Stencil
ShaderLab syntax: GrabPass

ShaderLab syntax: UsePass

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

The UsePass command uses named passes from another shader.

Syntax

    UsePass "Shader/Name"

Inserts all passes with a given name from a given shader. Shader/Name contains the name of the shader and the name of the pass, separated by a slash character. Note that only first supported subshader is taken into account.

Details

Some of the shaders could reuse existing passes from other shaders, reducing code duplication. For example, in most pixel lit shaders the ambient or vertex lighting passes are the same as in the corresponding VertexLit shaders. The UsePass command does just that - it includes a given pass from another shader. As an example the following command uses the pass with the name “BASE” from the built-in Specular shader:

    UsePass "Specular/BASE"

In order for UsePass to work, a name must be given to the pass one wishes to use. The Name command inside the pass gives it a name:

    Name "MyPassName"

Note that internally all pass names are uppercased, so UsePass must refer to the name in uppercase.

ShaderLab syntax: Stencil
ShaderLab syntax: GrabPass