What appears to be randomly we will get this error with all of our WebGL games, when this occurs the game will just progress to the end of the WebGL loading bar and then just get stuck and never load, which makes sense.
Unfortunately I cannot reproduce it, it does happen randomly, nothing seems to stand out, expect that error message is always there.
Yeah we’ve been having the issue as well. I just found out where this issue is (or where I think it is). It appears to be related to a issue in UnityLoader.js:
The relevant line of code that is causing the issue is: setTimeout(openRequest.onerror, 1000). Basically, what seems to be happening is that the loader waits for IndexedDB to start up for 1 second then gives up. If the user has a slower machine this might happen. This will just cause PlayerPrefs to not save and data caching to fail. I think Unity fixed the data caching crash in the early 2018 releases, but the underlying issue still seems to exist.
You can reliably reproduce the error if you put the below JavaScript on your page. It will delay IndexedDB opens by 5 seconds.
I think you can avoid the issue by upgrading to the most recent version of Unity or turn off “data caching” in the publishing settings in WebGL’s player settings (more info here).
Either way though, the PlayerPrefs will stop working occasionally until Unity fixes the UnityLoader.js file. I’m pretty sure this issue still exists in Unity 2018.2. You could change UnityLoader.js to have a longer timeout, but that’s kind of annoying to do (if you want to I can walk you through that process).
Yes. That’s what I meant by the data cache crashing. I observed it in 2017.2, and I thought they fixed it in 2018.1, but maybe not? Try compiling with “data caching” turned off. This fixed the freeze in loading for us.
If you want to force the IndexedDB failure so that you can test it, put the second piece of JavaScript from above into your web page.
So this what I think is happening to you:
IndexedDB takes too long to start and UnityLoader.js gives up loading IndexedDB.
Data caching crashes, because IndexedDB didn’t start.
Ok, Thanks I wasn’t sure if that is what you meant, I am going to pass this along to our deployment dev and see if there is anything we can do about this.
What is “Data caching crashes, because IndexedDB didn’t start” ?
My Firefox version have bugs with IndexedDB and this unity code, related to “data caching” option, log to console “indexedDB database could not be opened”, simple, and not crashes. Why it should crash?
I am getting this problem sometime while i am using unity 2018.9. I even unable to change the time duration in unityloader.js file because it is minified and i am unable to find the location of that syntax.
Disabling data caching is not a suitable option i guess because it won’t allow faster load. How you solve this issue?
Yeah by increasing the time, i never found any report that the problem is producing again. But i still searching for better and proper solution as you can forget to edit the compile code after build.