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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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