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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
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.