Documenting the dark corners of the Unity Engine.

User Tools

Site Tools


Shader Keywords

Shader Variant Fallbacks

Keywords will only take effect if a shader variant is present in the build with that exact set of keywords enabled.

If you set the keywords:


But the only shaders present in the build (after stripping) are:


Unity will apply a fallback mechanism1) to select a variant shader with the closest set of keywords.

Debugging Shader Variants

Sometimes it's useful to debug which shader variants and keywords are actually being included into a build. The “Compiled Code” drop-down in the shader inspector has a button to show the variants included in a build, and more importantly, why. Some keywords are always included in a build, globally, and some are only included if a scene uses a material with those keywords.

I'm not sure what the fallback mechanism is, exactly
shaderkeyword.txt · Last modified: 2021/05/10 21:16 by uninomiconadmin