Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

[HELP ME] Unity HTML5 + Playerprefs vs Updates

A topic by Alfred Alves created Nov 30, 2017 Views: 544 Replies: 9
Viewing posts 1 to 9

Hi, I'm developing a, HTML5 game that uses playerprefs to store data. It works perfectly.


I want to keep updating the game based on feedback and stuff like that, and when I generate a new build of the game and upload it to the game page, the playerprefs get lost and the player loses all progress.

Does anyone know if there is a way to upload a new build without losing the playerprefs saved data?

I already tried saving it with the same name, but it always resets everything.

halp pls


That's likely because the path to the game changes every time you upload a new version. This also breaks embeds, by the way. I'm not aware of any fix.

(1 edit)

Yeah, it looks like there's no way to fix this... I'm looking for an alternative way to save data.

For those who find this post after searching this problem on google, I'll be editing this answer to include any interesting stuff I find.

I'm currently trying to follow this -> It's kinda old but I think it still works in newer unity versions. This doesn't work because it involves creating a file and, for security reasons, WebGL is not able to write files. (It's still a good way to save files on other platforms though).

I'm still searching for PlayerPrefs alternatives.


This is a known issue but we don't have any solution right now. The way we do our CDN and caching means that new uploads get entirely new URLs. If you make any progress on getting saves to work across URL changes please tell us, I'd like to write up a guide for other that have the same problem. Thanks

You could get the game to generate a string of encrypted text for the save file and have the player manually save it. It's a horribly messy solution but it would work.

I've subbed to this page, I'm hoping someone comes up with a better answer.

I found this article but I didn't have the chance to test it out yet. I will probably have time for that later next week. If anyone have success following the article before I can try it, let me know and I will change the original post and the title so people can learn about it.

Awesome. I'd avoided using binaries because I thought it was incompatible. 

If you have a competitive/multiplayer aspect it's probably worth using System.Convert.ToBase64String / FromBase64String to obscure the data.

When I updated my WebGL game, save data did not carry over.  I was using the binary formatter method, similar to the link above, as well as player prefs for a few options.

I think the Application.persistentDataPath changes when we upload a new build too, maybe using a different path would work.

Also, we could implement a SNES-like password saving system, it's not a stylish solution, but it's maybe a good temporary one.

The easiest way is to save it on an external database if you want to keep your settings persistent