Quick answer: Unity Shader Graph keyword toggle works in editor but no-ops in build? The variant for the off state was stripped — mark the keyword as Always Included or use a Material Property keyword.

A shader has a Receive Shadows toggle that works in editor and disappears in build. The variant for that combination was stripped during build.

Keyword Type Matters

Shader Graph keywords come in Material, Global, and Unity-built-in flavors. Material keywords are kept per-variant if you reference them. Global keywords need explicit inclusion.

Strip Unused Variants

The build strips unreferenced variants. If the build only ever uses keyword OFF, the ON variant is stripped — same in reverse. Toggling at runtime requires both.

Always Included Shaders

Project Settings → Graphics → Always Included Shaders. Add the shader graph’s shader. Combine with a Shader Variant Collection to preserve all needed combos.

Preload Variants

For runtime keyword switching, set the keyword once in the editor (Play once) and save a Shader Variant Collection so the build keeps both states.

Verifying

Toggle the keyword at runtime in the build — visual response identical to editor. No magenta materials or default values.

“Keyword variants get stripped. Always-include the shader or save a variant collection.”

Use Material keywords for designer-facing toggles; reserve Global keywords for runtime quality switches managed by code.