Unity Issue Tracker - Shader pass overridden by fallback when using "UsePass" directive
Closed
UUM-68470
Shader pass overridden by fallback when using "UsePass" directive
Unity: Shader System
As Designed
6.0.X
2023.2.X
2022.3.X
2021.3.X
UsePass adds all passes that match the given name in the given shader, including its fallbacks.
Reproduction steps:
1. Open the attached “repro_IN-72668“ project
2. Open the “/Assets/Scenes/SampleScene.unity“
3. Open either the Scene view or Game view
4. Observe the “Sphere“ GameObject
Expected result: The “Sphere“ GameObject appears red
Actual result: The “Sphere“ GameObject doesn’t appear red
Reproducible on: Windows 10 (22H2)
Not reproducible on: No other environments tested
Notes:
Reproducible in Player
The custom surface shader defines a pass that should render the “Sphere“ GameObject red, or, in other words, return a (1,0,0) value. However, the Editor is also drawing the fallback shader's "Diffuse" pass after the custom shader's pass. This fallback shader pass most likely defines a different color, overriding the red color definition
Frame Debugger shows that the “Diffuse“ shader’s pass is drawn after the correct surface shader’s pass. This confirms that both the fallback shader and the custom shader is invoked
Prioritise and Follow this issue
Have a workaround or additional info about this issue?