I’m building an app to Apple Vision Pro, and I noticed that shaders variants were being compiled for URP. However, I’m using PolySpatial which means that URP is not used but Apple’s RealityKit will be taking care of rendering.
So is thid an unnecessary step during the build process?
Not necessarily, since you could be using the URP shaders to render to a RenderTexture using Unity, and we currently have no way to know at build time if you plan to do that. We do plan to look at reducing or removing this kind of unnecessary shader generation in the future, perhaps just by having an option in the settings to disable it if you know you’ll never use the shaders at run time.
There are various settings in the editor that you can use to reduce the number of variants generated. Notably, in Player Settings → Graphics, there are options to strip out the variants associated with lightmaps, fog, instancing, etc. In the worst case, each option that isn’t stripped out is going to double the number of variants generated, so stripping out more options can significantly reduce the number of variants generated.
