Add built-in keyword sets
Use Unity shader directive shortcuts to create sets of shader keywords and variants.
読み終わるまでの所要時間 2 分最終更新 19日前
You can use Unity shader directive shortcuts to create sets of shader keywords and variants. For example, the following example adds and keywords and variants:
SHADOWS_DEPTHSHADOWS_CUBE#pragma multi_compile_shadowcaster
Shader directive shortcuts
Shortcut | Shader keywords Unity adds | Unity adds a shader variant with all the keywords off | Shader pass that uses the shader variants |
|---|---|---|---|
| | Yes | Fog |
| | No | |
| | No | |
| | No | |
| | No | |
| | Yes | Instancing |
| | No | All passes that draw real-time light and shadows, except Light Probes. |
| | Yes | Particle System passes. |
| | Yes | |
| | No | |
| | Yes | Screen-space shadows. |
Remove variants
You can use the directive to remove keywords you don't use.
skip_variantsFor example, the following example adds the keywords for the set, but removes the and variants.
multi_compile_fwdaddPOINTPOINT_COOKIES#pragma multi_compile_fwdadd#pragma skip_variants POINT POINT_COOKIE
Refer to Strip shader variants for more information about removing variants.