Copyright © 2026 Unity Technologies
While the defined custom pass is trying to mask objects to not be grayed out, HDRP/Lit shader's Forward pass is used. And the shader variant for the pass is stripped out in the build process because the render pipline asset sets Lit Shader Mode as Deferred Only. Therefore the editor has the shader variant whileas the built player doesn't. It sounds a bit complicated, but that is how our shader stripper works. And I think CustomPassVolume and CustomPass APIs are for advanced level users, so IMHO it is supposed to be something which the target user should understand! In order to solve this, obviously the best way is you can write your own shader because the custom pass has a specific purpose to draw the mask texture, and which is different from HDRP/Lit. But there are also other simple workarounds. Set Lit Shader Mode to Both or Call CustomPassUtils.DrawRenderers() with an explicit shader tag that isn't expected to be stripped out(ex. "DepthOnly")
Reproduction steps:
1. Open project “TestHDRP”
2. Open “New Scene“
3. Observe Scene view, and notice that the “Cube” GameObject is blue
4. Build And Run the project
5. Observe Player
Expected result: the “Cube” GameObject is blue while the surroundings are grayed out - same as Scene view
Actual result: the “Cube” GameObject and the surroundings are greyed out
Reproducible with: 2020.3.48f1, 2021.3.25f1, 2022.2.20f1, 2023.1.0b17, 2023.2.0a15
Reproducible on: macOS Ventura 13.2.1 (Intel), Windows 10 (by the reporter)
Issues you vote on will appear here