Recommended reading:
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 mechanism1) to select a variant shader with the closest set of keywords.
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.