Unity Issue Tracker - Dynamic Branches do not work with Strict Variant Matching
Fixed
UUM-34873
Dynamic Branches do not work with Strict Variant Matching
Unity: Shader System
Fixed
2023.2.X
2023.1.X
2022.3.X
Won't Fix
2022.2.X
Fixed dynamic branching keywords when using strict variant matching
Fixed dynamic branching keywords when using strict variant matching
Strict Variant Matching always fails when using Dynamic Branches instead of other types of keywords.
I've made a simple repro project, with Strict Variant Matching enabled, where I have a simple shader (Stripped down to almost nothing from the URP Lit shader) and two boxes in a scene. In the shader I have a define (USE_DYNAMIC) to switch between using a dynamic branch or multi compile for the three Fog keywords.
Expected results are:
Fog disabled: RED
Fog enabled with USE_DYNAMIC disabled: BLUE
Fog enabled with USE_DYNAMIC enabled: GREEN
In the editor everything works fine but if the define is set to 1 and you make a build and run, Strict Variant Matching will fail and render the boxes in magenta.
Prioritise and Follow this issue
Have a workaround or additional info about this issue?