I have been trying my best to lower the memory usage for my builds for Oculus Quest 2, using the Memory Profiler and Editor Logs to assess the largest objects in memory. Consistently, the URP Lit shader is taking up way more space than anything else, even after my efforts to ensure that my assets reference URP Simple Lit instead.
In the Memory Profiler, I’ve even got it to the point where it states that there are 0 references to the lit shader.
Is there anything I can do to make sure it is no longer included in my Android builds?
Edit:
I’ve gone through the Resources folder and ensured that no assets are using URP Lit, but the shader still takes up a large amount of memory during runtime.
If you are 100% sure you don’t need URP Lit shader in your project, you could manually strip it using IPreprocessShaders class and it’s OnProcessShader method. Simply check if the name matches the URP Lit name and remove it from the list if it is the case.
See this article for more information : Shader Stripping
Another way would be to check if some Lit Variants are used with the Currently Tracked variants in the Graphics Settings. You could strip it more accurately (keeping some needed variants and discarding the rest).
And it will be included if referenced, so I think you probably have a material somewhere in your resources that depends on Lit. Even so it is a lot of memory at runtime, more than I expected.