|
metadata
# As this player here says:

Basically their game appears to have been deleted but upon refreshing the browser, their data is back. I've been up and down my C# code in Unity and it just isn't an issue in there. This problem also doesn't happen to everyone. In fact, I've been idling with my own game for weeks in Chrome and haven't seen anything like this happen to me.
Has anyone experienced a problem like this? I just need to know what to tell the people playing my game at this point because if the problem is with how caches are being handled in the browser it's out of my control.
I really think it's a cache reading issue that is somehow fixed upon refresh, it would make the most logical sense.
I am saving locally using PlayerPrefs and am not using a web server since I can't afford a server that can handle the loading and saving of everyone's data.
|
|
metadata
I'm not too versed in Unity, so someone else should definitely come on and assist, but have you tried setting up a double-buffer for cache checking? Check to see if there are any saves at the start of your project, and then restart your project with a 'Checked Once' flag enabled. If you've already checked, then just check once and continue. Might help a little bit.
Alternatively, check your code for New Game and see how it influences saves. Maybe your game recognizes there is a save, but something along the way isn't enabled properly. However, as you stated, this definitely seems like a browser issue, not a code issue.
|
|
metadata
I had that issue with my game, Blockable. I'm not sure if it is still there but last time, that issue happen from time to time and like you said, refreshing fixed it. Sadly, I don't have any solutions for now but my plan for my next game is to load/check any save data once the player clicked a button, like the Play button rather than doing that immediately once the game load. If that doesn't fix the issue, the only thing I can come up with is to use a free backend service like [PlayFab](https://playfab.com). I've tried it before and there was some issues that I think was my fault (I didn't really understood how it worked) but I do remember having it worked once so you probably should give that a go.
|
|
metadata
Cross-referencing a thread that PlazmaGames commented up with possible helpful information regarding this issue:
http://www.kongregate.com/forums/4-game-programming/topics/488692-webgl-and-playerprefs-unity
Thank you PlazmaGames!
|
|
metadata
Looks like I forgot to mention it, but as it can be browser related, then I probably should: I am using Firefox 52.0.2 (64 bit), these issues I had were probably on 52.0.1. It didn't happen to me in last few days, but I will try to keep attention to if I wasn't doing something with my browser, if it happens again. (I don't even clear cache and other stuff recently, so no idea what can trigger it.)
I play some other WebGL games, usually at the same time, like quite heavy (and I heard that game can have some memory leak issues sometimes) [Spellstone](http://www.kongregate.com/games/synapticon/spellstone). Not sure, if it can be related, but WebGL sometimes crashes for me, if I strain it too much with playing both games (mostly spellstones, Idle Conquest looks for me very light in comparison), having some youtube videos opened, some big .pdf files, plus doing some other stuff that adds up to this all. It almost didn't crashed in few last days though, as I had some work to do and didn't strained my browser too muich with some endless things at the same time, like I like to do :)
If it happens to me again, I will try to remember what I was doing before that or what happened (which sometimes can be hard to keep track on, as I rarely close browser and often leave it open for a day or two).
|
|
metadata
Had an interesting reply on my game as well.
Apparently, AdBlock can cause issues related to saving/loading as well. Was using a BinaryFormatter file named "saveData.dat" in the persistentDataPath, then calling FS.SyncFS() via jslib. I was getting replies that save files were missing on Firefox (and since Firefox is my main browser, it perplexed me). Had one player reply that when they disabled AdBlock, saving worked.
That might work for some people.
|
|
metadata
To throw in two additional ideas: Could this be related to being on a slow internet connection and/ or having the focus on a different tab?
Because this is when I noticed that kind of bug. Start the game, go to a different tab and do other stuff, let the game load, go back to the game tab. Sometimes the saves are missing. Hard to reproduce so it might be just a coincidence that I remember this problem in this context. But maybe we are lucky and that's a cause. :) I know for sure that some games just stop loading after a while (with slow i-net and doing other things meanwhile). Not so sure if on Kong or somewhere else though.
And as for browser related: I had this problem on Chrome (on a different game). So that's probably not the (main) cause.
|