Quick answer: Runtime-toggled keyword? Use Multi Compile. Material-baked keyword? Shader Feature. Wrong type means missing variant in build.

Editor toggle works. Build doesn’t. Shader Feature only ships variants seen on disk; runtime EnableKeyword has no static reference, so the variant got stripped.

The Symptom

Material renders incorrectly in built player when keyword toggled by code. Editor flips perfectly.

The Fix

Shader Graph Blackboard → Boolean Keyword:
  Reference:        _DAMAGE_FLASH
  Default:          Off
  Shader Type:      Multi Compile   // runtime toggle path

C# script:
material.EnableKeyword("_DAMAGE_FLASH");   // works in build now

Multi Compile guarantees both variants ship. Shader Feature requires a material on disk with the keyword baked in.

Verifying

Build player. Toggle keyword from script. Shader updates correctly. With Shader Feature: stays default until a baked-in material loads.

“Multi Compile for code. Shader Feature for assets. Variant ships.”

Related Issues

For variant stripping, see keyword strip. For Shader Graph custom function, see custom function.

Multi Compile for runtime. Variant present.