Version: 2020.3
ShaderLab: defining material properties
ShaderLab: assigning a custom editor

ShaderLab: assigning a fallback

This page contains information on using a Fallback block in your ShaderLab code to assign a fallback Shader object. For information on how a Shader object works, and how Unity chooses when to use a fallback, see Shader objects introduction.

렌더 파이프라인 호환성

Feature name 빌트인 렌더 파이프라인 유니버설 렌더 파이프라인(URP) 고해상도 렌더 파이프라인(HDRP) Custom SRP
ShaderLab: Fallback block 지원 지원 지원 지원

Using the Fallback block

To assign a fallback, you place a Fallback block inside a Shader block.

Signature 기능
Fallback "<name>" If no compatible SubShaders are found, use the named Shader object.
Fallback Off Do not use a fallback Shader object in place of this one. If no compatible SubShaders are found, display the error material.

Fallback code examples

This example code demonstrates the syntax for creating a Shader object that has a named fallback.

Shader "Examples/ExampleFallback"
{
    SubShader
    {
        // Code that defines the SubShader goes here.

        Pass
        {                
              // Code that defines the Pass goes here.
        }
    }

    Fallback "ExampleOtherShader"
}
ShaderLab: defining material properties
ShaderLab: assigning a custom editor
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961