Search Issue Tracker
By Design
Votes
0
Found in
2021.2.0a18
2021.2.9f1
2022.1
2022.2
Issue ID
1401187
Regression
Yes
GameObject with a custom Shader is invisible when multi_compile keywords order is switched
How to reproduce:
1. Open the attached project "haircut_repro"
2. Open the scene "SampleScene" (Assets/Scenes/SampleScene.unity)
3. In the Scene view window, toggle on the 2D view
4. Observe the GameObject "Rice"
Expected result: The character's full haircut with bangs is visible
Actual result: The character's bare forehead is visible
Reproducible with: 2021.2.0a18, 2021.2.12f1, 2022.1.0b8, 2022.2.0a4
Not reproducible with: 2019.4.36f1, 2020.3.29f1, 2021.2.0a17
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 (2022.2.X):
The shader exposes two toggles: [Toggle(CUBISM_MASK_ON)] and [Toggle(CUBISM_INVERT_ON)]. The material in question has both turned on.
With "#pragma multi_compile CUBISM_MASK_ON CUBISM_MASK_OFF CUBISM_INVERT_ON" the shader is generating three variants: CUBISM_MASK_ON, CUBISM_MASK_OFF, CUBISM_INVERT_ON. The material asks to use a variant "CUBISM_INVERT_ON CUBISM_MASK_ON" which doesn't exist. The documentation says clearly that in case of an impossible variant, it will pick one of the existing ones. Changing the order of keywords changes the variant picked.
I would suggest to use two directives here:
#pragma multi_compile _ CUBISM_INVERT_ON
#pragma multi_compile _ CUBISM_MASK_ON
The variant it asks for will actually exist in this case and the rendering will be correct.