Quick answer: material.EnableKeyword("_FOG_ON") + material.SetFloat("_FogOn", 1f). Both lines required.

You drag the keyword toggle in the inspector, shader updates. From script via SetFloat alone, no change.

The Fix

void SetFog(bool on) {
    if (on) material.EnableKeyword("_FOG_ON");
    else   material.DisableKeyword("_FOG_ON");
    material.SetFloat("_FogOn", on ? 1f : 0f);
}

Keyword names match the Reference field on the Boolean Keyword in the Blackboard. SetFloat alone updates the property but not the chosen variant.

Verifying

Toggle from script. Variant swaps. Without EnableKeyword: shader stays on the default branch.

“EnableKeyword + SetFloat. Both. Variant flips.”

Related Issues

For Multi Compile vs Shader Feature, see keyword type. For variant stripping, see strip.

Two calls. Variant ships.