====== Shader Keywords ====== Recommended reading: * https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html ===== 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: cmd.EnableShaderKeyword("_KEYWORD1"); cmd.EnableShaderKeyword("_KEYWORD2"); cmd.EnableShaderKeyword("_KEYWORD3"); But the only shaders present in the build (after stripping) are: _KEYWORD1 _KEYWORD2 _KEYWORD2 _KEYWORD3 Unity will apply a fallback mechanism((I'm not sure what the fallback mechanism is, exactly)) 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. {{ :unity_4llyy1titq.png?200 }}