00:00
00:00
Newgrounds Background Image Theme

Someone gifted MetalSlayer69 supporter status!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Save File Erases After Updating

333 Views | 2 Replies
New Topic Respond to this Topic

Save File Erases After Updating 2023-08-18 13:27:45


I've been made aware that updating my Unity game on the website causes the save file location to move to a new location. My game uses Application.persistentdata path to find a place to save a json file, but how can I update without the location changing? Are playerprefs what Unity games need to use to save their games without being lost?


I know you can avoid the issue if you use File (which will point to a place in IndexedDB which you can specify as a parameter to its functions) and hard code a path to something like yourName_yourGamesName so it doesn't change when you push an update to your game.


It might be better to see how I did it than try to explain -- this was a sorta slick thing I did when I assumed that most newbies would use PlayerPrefs (like I did in my first game) and get burned by it because it suffers from the same problem you're facing. I basically wrote a script to override Unity's PlayerPrefs behavior and make it write to a location you want. Here's the source code, and the class constructor and Save() function are probably what you want to pay attention to.


My newsfeed has random GameDev tips & tricks

Response to Save File Erases After Updating 2023-08-19 14:42:20


You are a live saver. Thank you!!!