Search Issue Tracker
Fixed in 2022.1.X
Votes
0
Found in
2020.3.20f1
Issue ID
1374795
Regression
No
Shader displays different colors in Editor and when using Build
Reproduction steps:
1. Open the project "1374795.zip"
2. Open "SampleScene" in the Assets folder
3. Watch the colors of cubes in the Editor
4. Build and Run the project
5. Watch the colors of cubes now
Expected result: the left cube is red, the right cube is green
Actual result: both cubes are green
Reproduces on versions before 2021.2
Note:
- Both cubes got a Material with the custom Shader "NewUnlitShader" on them
- It is only reproducible if red Material's keyword string does not contain _COLOR_RED
- It is not reproducible if there is only 1 cube
- The issue can only be seen in Standalone Build, but not in the Editor
- Reproducible both in Mono and IL2CPP
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note (fix version 2022.1):
The material keyword system used to lack validation of the state, which could cause the material to have an invalid keyword state. In this case particularly, the red material did not have either _COLOR_RED or _COLOR_GREEN selected, which caused it in the player build to select the only existing variant, which was the green one.
This issue is already fixed in 2021.2. While waiting for the potential backports, on older versions it is possible to workaround the issue by selecting the material and then in the inspector selecting a value for each KeywordEnum. This will set a valid keyword state.
Fixed in: 2021.2.0a18