Unity Issue Tracker - "Shader.EnableKeyword" does not affect the shader when its keyword value is larger than the enum value set on the material
Closed
UUM-73623
"Shader.EnableKeyword" does not affect the shader when its keyword value is larger than the enum value set on the material
Unity: Shader System
As Designed
6.0.X
2022.3.X
2021.3.X
When the material and the global state both enable a keyword from the same keyword list, it ends up trying to select a non-existing variant.
When this happens, some close enough variant gets picked.
How to reproduce:
1. Open the “TestShaderGraphMultiCompileKeyword“ project
2. Open the “SampleScene“
3. Open the “Shader Graphs_MultiCompileShader“ material in the Inspector
4. Set the “BaseColorMode“ property to “Red“
5. Open the “Custom Camera (Global keyword)“ GameObject in the Inspector
6. Set the “Base Color“ property to “BASECOLORMODE_BLUE“
7. Observe the Game view
Expected result: The smaller cube is blue
Actual result: The smaller cube is red
Reproducible on: macOS 13.5.2 (Intel), Windows 11 (User’s)
Not reproducible on: No other environments tested
Note: It seems that the “BaseColorMode“ has a hierarchical priority, or the “Base Color“ only comes into affect if it is higher in the list than the place of the “BaseColorMode“ chosen element
Prioritise and Follow this issue
Have a workaround or additional info about this issue?