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

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.

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?

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.

1 Like

Thanks, I’ll give it a try.

1 Like

The issue persists after clearing up the library folder.

Okay - worth a shot anyway, hopefully someone else can suggest something that will work for u :slight_smile:

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.

1 Like