URP Lit Shader uses large amount of memory according to memory profiler - Oculus Quest 2

Hello there,

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?

Unity Version:
2020.3.18f1

URP Version:
10.6.0

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.

Hello,
Is that shader listed in the Graphics Settings > Always Included Shaders?

Hi Martin, thanks for the response!
I wish I could say it was and that it was that simple of a mistake on my end, but it is not.

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).

Well the resources folder seems to think it does have a reference to lit somewhere:

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.

Project Auditor might be able to find out why it was included, if it was included via something in a Resources folder.