Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

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

Discussion in 'Universal Render Pipeline' started by MOTYSHIZ, Sep 17, 2021.

  1. MOTYSHIZ

    MOTYSHIZ

    Joined:
    Apr 12, 2016
    Posts:
    5
    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

    upload_2021-9-17_15-51-5.png

    upload_2021-9-17_15-48-20.png

    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.
     
    Last edited: Sep 18, 2021
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,469
  3. MOTYSHIZ

    MOTYSHIZ

    Joined:
    Apr 12, 2016
    Posts:
    5
    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.

    upload_2021-10-10_13-53-48.png
     
  4. rob11

    rob11

    Joined:
    Mar 7, 2017
    Posts:
    59
    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).
     
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Well the resources folder seems to think it does have a reference to lit somewhere:
    upload_2021-10-12_19-17-0.png

    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.
     
  6. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,469
    Project Auditor might be able to find out why it was included, if it was included via something in a Resources folder.