Hi,
I’m newer on WebGL platform, I’m a bit confused about IndexedDB API 2.0.
Does Unity WebGL support IndexedDB API 2.0?
Hopefully, someone can answer or share a related document.
Many Thanks!
It uses IndexedDB internally, for example to store PlayerPrefs data and caching, but this isn’t exposed to C# so it doesn’t matter which version it is. The PlayerPrefs storage is also limited to 1 MB.
This is everything the manual provides about IndexedDB:
@CodeSmile , thank you for your answers.
As I know, IndexedDB 2.0 will provide some API that may increase the loading speed like getAll().
But in .framework.js is generated when building WebGL, I see this js file only using get() and put() method of IndexedDB, which is a bit confusing.
Unity uses IndexedDB in three different ways:
- Emscripten IDBFS filesystem that is implemented at emscripten/src/library_idbfs.js at main · emscripten-core/emscripten · GitHub . For persisting savegame data. This is the one that you are seeing in framework.js file.
- UnityCache.js: for caching network request metadata. (Network request file data is cached in Cache API instead)
- WebGPU shader cache.
It looks like WebGPU shader cache does use the .getAll() function, but Emscripten IDBFS and UnityCache do not.
Are you seeing performance issues in this area? (If you are knowledged in IndexedDB internals and have a strong opinion in how it should work, then if you want to modify the Emscripten project with some optimizations to their IDBFS filesystem and do a PR to them, that would be picked up by Unity in a future compiler update)
jukka_j , thank you for your detail answer.
As such Untiy WebGL does not use getAll() of the IndexedDB API 2.0 for the Cache API.
Oh No, as said above I’m just a Newbie on WebGL platform, I just want to know about IndexedDB and the improvements in IndexedDB API 2.0 and the way that Unity is using these improvements. And your answer is enough for me.
Many thanks!