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
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
- Entities Hierarchy Search “Show/Hide” button’s Lens Icon is blurry when the Editor is on an external monitor
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.