Good day to you all.
I have this weird issue where Unity strips out used and necessary shaders when I do a build with either the strip all or strip unused options on shader variant stripping. I’m using Shader variant collections to make sure that the engine knows what shaders are neccesary and it still seems to strip out shaders that are needed and I’m kind of out of options. Builds with keep all takes days, which is not very sustainable to say the least but that’s the only way it seems to work.
When I enter a level of the build, the whole thing is reduced to basically 1 frame every 5 or so seconds, half the level is missing and after about a minute it crashes. The funny thing is that it doesn’t affect the entire computer, it’s just the Unity application that is unresponsive. I tried adding URP/Lit and other variants to the Always Included Shaders list but that resulted in the same thing.
I welcome any tips on reducing shader variants as well, what is a good way of going about shaders and stripping out manually that might not be needed, especially store bought assets as they blow up the shader variant count.
Unity logs that I deem important (I’d love to upload the whole thing but it’s 10 mb in size and just spams these two entries in seemingly random sequence, I don’t use DOTS anywhere in my project as far as I’m aware but there might be some internal Unity thing that uses it for rendering):
Shader Universal Render Pipeline/Lit, subshader 0, pass 3, stage vertex: variant DOTS_INSTANCING_ON not found.
0x00007ff9fd57616e (UnityPlayer) UnityMain
0x00007ff9fd3704a2 (UnityPlayer) UnityMain
0x00007ff9fd56b3ce (UnityPlayer) UnityMain
0x00007ff9fe1ef701 (UnityPlayer) UnityMain
0x00007ff9fcf4d7aa (UnityPlayer)
0x00007ff9fcf58220 (UnityPlayer)
0x00007ff9fcf56034 (UnityPlayer)
0x00007ff9fcf44b30 (UnityPlayer)
0x00007ff9fcea2698 (UnityPlayer)
0x00007ff9fcc5262f (UnityPlayer)
0x00007ff9fcc61f10 (UnityPlayer)
0x00007ff9fcc622cd (UnityPlayer)
0x00007ff9fd556019 (UnityPlayer) UnityMain
0x00007ff9fccbe3ca (UnityPlayer)
0x00007ff9fccbcd0b (UnityPlayer)
0x00007ff9fccc09e9 (UnityPlayer)
0x00007ff9fcfc445b (UnityPlayer)
0x00007ffacf6de8d7 (KERNEL32) BaseThreadInitThunk
0x00007ffad122c53c (ntdll) RtlUserThreadStart
Shader Universal Render Pipeline/Lit, subshader 0, pass 1, stage vertex: variant DOTS_INSTANCING_ON _CASTING_PUNCTUAL_LIGHT_SHADOW not found.
0x00007ff9fd57616e (UnityPlayer) UnityMain
0x00007ff9fd3704a2 (UnityPlayer) UnityMain
0x00007ff9fd56b3ce (UnityPlayer) UnityMain
0x00007ff9fe1ef701 (UnityPlayer) UnityMain
0x00007ff9fcf4d7aa (UnityPlayer)
0x00007ff9fcf58220 (UnityPlayer)
0x00007ff9fcf56034 (UnityPlayer)
0x00007ff9fcf44b30 (UnityPlayer)
0x00007ff9fcea2698 (UnityPlayer)
0x00007ff9fcc5262f (UnityPlayer)
0x00007ff9fcc529bc (UnityPlayer)
0x00007ff9fcc4e130 (UnityPlayer)
0x00007ff9fcc4e6cc (UnityPlayer)
0x00007ff9fd556019 (UnityPlayer) UnityMain
0x00007ff9fccbe3ca (UnityPlayer)
0x00007ff9fccbcd0b (UnityPlayer)
0x00007ff9fccc09e9 (UnityPlayer)
0x00007ff9fcfc445b (UnityPlayer)
0x00007ffacf6de8d7 (KERNEL32) BaseThreadInitThunk
0x00007ffad122c53c (ntdll) RtlUserThreadStart
Other details that might be important to the issue:
- I’m using URP with Forward+ rendering and the GPU Resident Drawer enabled
- I have both shadows and Additional Lights enabled
- There is Post-Processing present with Shadow Midtones Highlights and Color Adjustments enabled
- The project has been basically dragged kicking and screaming all the way from 2019 to 6.2f2 (everything else works perfectly but this might affect build times)
- I’m using two store bought assets that blow up the shader variant count: INab Studio’s Dissolve Shader and the All in 1 VFX toolkit, other than these two, there are small shaders from Synty asset packs where the only one that has a significant amount of shader variants is from their nature pack, and it’s their tree wind shaders but even that is a fraction of the shader variants that are being compiled for basic things like URP/LitTerain
- I’m using realtime lighting and reflections, so nothing is baked aside from a single reflection probe that is used to fake environmental reflection on shiny surfaces
- I’m using linear fog and no other types of fog
- I only have one Quality preset

