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
- Crash on [NSApplication endModalSession:] when saving while Play Mode is loading
- Incorrect Preferred Height calculation when a single text line uses different Font Assets
- [ShaderGraph] Redo Collapse Nodes action does not fully collapse the Nodes
- [Ubuntu] Mouse cursor is set box select mode after exiting VFX Graph's Rename Context function
- Unrecognized identifier DECLARE_STACK_CB error is thrown when VirtualTexture Property is used with Custom RenderTexture target
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.