I want to have a branch of our project running on URP, but facing (after removing HDRP) VERY long build times due to some compilation of HDRP shader variants, which should not exist anymore; These are HDRP/Lit TransparentBackface and HDRP/Lit Forward.
, so I started migrating with the following steps:
installing URP
configuring URP as Assets in project settings
removing HDRP from package manager
upgrading materials / shader graphs.
As I don’t need all shaders of the project, I only migrated the needed once to URP. I removed all traces of HDRP shaders from the build scene and from the StreamingAssets directory. Still it takes hours to compile some “ghost” HDRP shaders.
To understand a bit more where the issue comes from I’m curious, has the project been built before when only HDRP was in use in the project or both HDRP and URP? I would suggest trying to clear out the Library folder with your HDRP package removed and try to build again to see if that helps.
If that does not help, to be completely sure HDRP package has been removed be sure to:
Check that Project Settings → Graphics render pipeline asset has URP asset assigned and none of the quality settings have HDRP asset in use
Check project Packages → manifest.json file and check there is certainly no paths that have
“com.unity.render-pipelines.high-definition” entry
Check that Packages folder have no local High Definition Render Pipeline package folder
With upcoming 2023.1 version of Unity stripping has improved a bit in cases where two pipelines are in use on the same project, which should also address the issues you face performing a build after making a switch to URP with HDRP package removed.
If Library clear does not help, could you share your Temp/shader-stripping and Temp/compute-shader-stripping files after the long build has been performed? The shaders that end up problematic and you are sure you do not need, you could try implementing your own shader preprocessor to skip them: Unity - Scripting API: IPreprocessShaders.
I finally managed to remove HDRP completely. I had another package installed (digital human), which had a dependency to HDRP, thus HDRP was still present in the Library folder, not visible in the package manager nor manifest. Now I get proper errors when I reference HDRP stuff, and no more shader compilation of unused HDRP shader