Search Unity

Question Shaders take a lot of memory RAM space

Discussion in 'Shaders' started by everalan10, Aug 31, 2021.

  1. everalan10

    everalan10

    Joined:
    Mar 8, 2014
    Posts:
    10
    Intro
    Hi devs, we notice via the Memory Profiler, that our game takes a lot memory RAM space and crashes on consoles with 8GB of RAM



    Our Questions
    1. Do you have any code example of stripping shader variants to shrink RAM memory space used by the Lit Shader?
    2. How could we reduce the huge amount of shaders memory RAM space?

    Extra info
    • We have implemented the IPreprocessShaders interface to these 3 files
    • On Switch platform loads correctly, we supose the complilation of shaders is different.

    Our setup
    • Unity 2020.3.14f1
    • Addressables
    • Hybrid Renderer, for a procedural city's buildings (a lot of them)
    • These Unity packages (Packages.png)
     

    Attached Files:

  2. rob11

    rob11

    Joined:
    Mar 7, 2017
    Posts:
    59
    Hey ! I am also using Addressables and having issues with shader memory footprint. I have scouted the internet for a few days now and pretty sure it has to do with Addressables and excessive shader variants. The more I add scenes to my Addressables build the more my shaders take memory. Even shaders that are solely used in one scene are growing with the build complexity.

    Have you found a solution to this ? Thank you