Two days ago I had to wipe my Library folder in an attempt to fix ~20 minute loading times when opening my Unity project. I deleted 2.5 million files totaling 175GB. I only have 9GB of assets so I’m unsure how this could be a normal occurrence. Today I noticed the same slowdown when opening the project and sure enough, my Library folder is now 81GB with ShaderCache.db eating up 63GB. I’m only using a few shaders (mainly variations of Lit) in my scenes. Is this normal?
Edit: No, this isn’t normal. Performance slowly deteriorates with every Android build until the editor literally becomes unusable. I’m nuking 80GB of garbage data every day to maintain my sanity. Task Manager shows me the editor reading up to 15GB/s from disk when idling.
I have a similar issue, where the size of the ShaderCache.db grows exponentially when building to iOS or Android.
Tested on two Win10 machines, the problem occurs using the 2020.2 releases. Using just the example URP project to test.
It is fine when building to the Windows platform, and the ShaderCache.db remains a few kb in size.
Using the 2019.4 and 2020.1 releases, the problem is not present at all: building to iOS or Android works fine and the ShaderCache.db remains just a few kb.
So it appears to be an issue with 2020.2 and the latest Universal RP 10.x packages when building to mobile. The file size increases during the ‘compiling shader variants’ process.
Can somebody confirm if this is a know issue? I can’t find any mention of it in the tracker.
Hey guys,
Here a possible workaround: I just deleted the ShaderCache.db file from Library.
On my side that file alone had 4Gb and after I saw that the reason for Unity hanging was that my Hard Disk was in 100% writing that file I figured it must have something to do with it.
After deleting it and doing some development in Unity and also a successful apk build that file is 200 Kb. I imagine it will go up again in which case I am prepared to delete it again
My shadercache.db was 21GB!!!
It was stopping my project from opening as it just sat there saying ‘Importing’ (I’d left it for an hour).
This is for a small Oculus Quest 2 (Android) test project with about 20 objects. Unity version 2020.2.4f1
I have built it many, many times though as my PC is really underpowered and can’t manage to just run on the device linked to Unity, but has to do a full build and run it standalone.
Deleting the shadercache.db allowed my to open the project again.
Daniel, when I delete the shadercach.db file and rebuild to a iOS/Android, the file immediately starts to grow again.
Using only the default sample URP project, this is what happens:
2019.4 - before build: 3kb, after a mobile build: 3kb.
2020.1 - before build: 12kb, after a mobile build: 12kb.
2020.2 - before build: 24kb, after a mobile build: 750MB.
In 2020.2, it appears deleting the shadercache.db file will make your editor responsive again if it’s causing slowdown, which is particularly evident on a larger project. But from my testing, the shadercache.db will quickly re-grow when you compile to mobile. This means you may need to delete it after every build as a workaround. Obviously this not a solution. The bug only appears to exist in the 2020.2.x series.
Hello Guys !
Sorry to hear that you have the same problem than me !
I also have a wooping ShaderCache.db of 12Go as I’m compiling my project for android…
The bad news is that I’m using Unity 2021.1.0b4.1811 so it seems this bug is going to exists for some time.
I’ll open a ticket in hope they will be able to fix this issue ASAP !
I just deleted the shadercache after tracking it down as the cause for my 10+ minute wait times when saving or reloading my unity project on an NVME SSD. It was 72GB.
My error, the bug is not marked as ‘fixed’ for 2020.3 as I mistakenly thought, it is actually listed under ‘known issues’. Sorry for the noise, hopefully it will be sorted soon.