I have a webgl project that is about 70mb. In unity 2019. It takes around 30 seconds to load the first time, then less than 5 seconds every time after.
with 2022 it takes 30 seconds every time.
I have tried setting data Caching on and off and compression on and off same result. The project settings are exactly the same as before.
Has something changed in the loader that would cause it to be so slow?
Few months ago i have made some test with the version 2021/2022 (i don’t remember) and i was confronted at a cache issue because they have change the cache system.
It seem to be a conflict between the old and new system trying to access at the same “IndexedDB” value or name but incompatible for the user that had saved the value from the old version.
-If a player have already loaded your game made with unity 2019 and try to load the game made with 2021/2022, then the conflict is present.
If a new player come for the first time and load your game made with 2021/2022 version , he will not have this issue.
Every visit, i had to download the game completely, so i have stay in 2019.
Unfortunately, i do not lose my time on the unity bug anymore. I have reported an issue that affect their official “stable” release on the webgl audio 3 months ago and it’s still in “Fix In Review”
I really hope now that in the coming years, some new actors will come and smash their business because everybody is lost and scared to upgrade.
It’s impossible now to have a correct “stable” version like in the past.
They spend so much time to patch 5/6 unity version instead of concentrating all their effort in one versions and without creating new bug or regression.
Anyway, everybody know the story. I hope that in 2024 we will be able to use the 2022 version without any issue…
I feel the same way afraid to upgrade – so far I’ve spent a week trying to upgrade and have had many weird failures – objects not loading properly, ghost packages being reinstalled after I threw them out. Then all versions of unity would not build because the new versions corrupted something in the project settings folder. This is why I was afraid to upgrade, now the cache problem with no answers.
Loading works fine in the stable build of 2021, but all 2022 builds do not work at all. Someone mentioned they are using a different fetch method. This is going to affect everybody with a webgl project who tries to upgrade.
Like for a lot of new or changed features, they are not tested.
This will affect everybody in 2/3 months, the time for them to check it and to fix it, we will be in 2023 summer …
After a long investigation, i have found the origin of the problem.
Unity 2020.3.40f1 and older version use the old Module.XMLHttpRequest (XMLHttpRequest.js) with :
var UnityCacheDatabase = { name: “UnityCache”, version: 2 };
var XMLHttpRequestStore = { name: “XMLHttpRequest”, version: 1 };
var WebAssemblyStore = { name: “WebAssembly”, version: 1 };
Unity 2021.3.11f1 and newer version use the new Module.UnityCache (UnityCache.js) with :
var UnityCacheDatabase = { name: “UnityCache”, version: 3 };
var RequestStore = { name: “RequestStore”, version: 1 };
var WebAssemblyStore = { name: “WebAssembly”, version: 1 };
The both use different method to use the indexedDB.
Example case with a project named “MyGame” :
Build it with Unity 2020.3.40f1 that use the old indexedDB system, the indexedDB will work as expected.
Now, if you build the same project with unity 2021.3.11f1 that use the new indexedDB system, when you will load your webgl game you will have the error “Could not connect to database: Timeout.”
If you delete the indexedDB and do the same but load a game that use the new indexedDB system and then load the game that use the old indexedDB system you will get the error “indexedDB access denied”
So we have a conflict between the old and new indexedDB code.
The quick solution that i have found to avoid any conflict is to change :
var UnityCacheDatabase = { name: “UnityCache”, version: 3 }; to var UnityCacheDatabase = { name: “UnityCache1”, version: 3 }; on the new indexedDB system Module.UnityCache.
It create a fresh separated DB that will not enter in conflict with the old one.
Also, some informations are missing on the new indexedDB system.
company, product, updated, revalidated, accessed field are empty compared to the old indexedDB system where you have all field with all informations.