What it does

A Shader Variant is a shader program built for a particular combination of features, such as shadows or fog. Keywords distinguish those combinations. They allow feature selection, but more variants increase compilation and build work.

Figure: Conceptual relationship: Shader keywords → Generate combinations → Run selected programs
Figure: Conceptual relationship: Shader keywords → Generate combinations → Run selected programs

How to use it

Keywords select separate GPU programs for feature combinations. Independent choices multiply, so keyword declarations alone do not give the final variant count.

A concrete example

Four independent on/off choices have sixteen simple combinations. Passes, stages, APIs, generated features and stripping further affect the actual build.

How to check it

  1. Inspect candidate and retained variants in build logs and remove genuinely unused combinations.
    First error, references and target environment
    First error, references and target environment
  2. Test runtime material and quality changes in Player to detect missing required variants.
    First error, references and target environment
    First error, references and target environment

Limitations

Stripping can remove combinations needed at runtime.

References