Search Unity

Question [Unity 2021.1.0f1] [HDRP V11.0.0] Shader graph shader has too many variants

Discussion in 'Shader Graph' started by rayming_smt, Mar 31, 2021.

  1. rayming_smt

    rayming_smt

    Joined:
    Oct 3, 2019
    Posts:
    29
    Hi all,

    I just upgraded my project from Unity 2019.3 and HDRP 7-ish to Unity 2021.1.0f1 and HDRP v11.0.0

    I kept getting this error on every shader graph shader I put on the always compile list.

    Code (CSharp):
    1. shader Graphs/Shader_Graph_Water has too many Shader variants(3145728)
    This wasn't an issue before and I don't think the shader is complicated enough to have so many variants.

    Maybe this is a bug in Unity 2021 or HDRP v11?

    Is there a workaround besides remove those shaders from the always compile list?
     
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    Try closing the editor and visual studio/code editor, back up your project, then delete the Library folder, then open your project again through Hub - it'll take a while starting up if you have a lot of assets but might fix it (has for me with upgrade-related issues). Not worth messing with project settings or modifying stuff until you've tried that.. if you haven't yet.
     
    rayming_smt likes this.
  3. rayming_smt

    rayming_smt

    Joined:
    Oct 3, 2019
    Posts:
    29
    Thanks, I'll give it a try.
     
    adamgolden likes this.
  4. rayming_smt

    rayming_smt

    Joined:
    Oct 3, 2019
    Posts:
    29
    The issue persists after clearing up the library folder.
     
  5. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    Okay - worth a shot anyway, hopefully someone else can suggest something that will work for u :)
     
  6. DrewFitz

    DrewFitz

    Joined:
    Dec 9, 2016
    Posts:
    30
    It could be internal HDRP shader utilities using lots of internal keywords (haven't deeply looked at this) that normally aren't considered based on platform/hardware, and indirectly adding them to the Always Compiled list forces Unity to try to compile every variant upfront. That's a shot in the dark though.
     
    rayming_smt likes this.