playerPrefs, persistantPath, or database?

Give your opinion. Is one clearly better (more reliable)?

For Android and iOS. I was saving persistent data as playerPrefs and then I read in these forums that that wasn’t the most clever way to code. About 20 variables.

So I moved my system over to a system - Json uses Application.persistantpath. But I’ve read posts where folks find issues with persistantpath on some android devices. But those posts all seem to be a few years old. Hmm.

Finally, I moved my system to storing the data on a simple mySQL database. (The game already needs that database for separate features so using the internet is a given).

Is anyone wary of Application.persistantpath and supports my database solution or is my database solution overkill?

ty

For 20 variables playerprefs is fine. Much more and reach for JSON and write it to disk.

I’ve only used mysql in read-only mode under unity and I did have to copy it out of the APK and to persistent storage before I could open the DB. I assume writing would work but I did not try it.

For 20 variables? Yeah, kinda. I’d just write it to persistent storage.

Unfortunately, your question is a bit broad. Everything has it’s place and should be used as such. I generally use playerprefs for settings and stuff that if lost, isn’t a big deal.

PersistantDataPath is good for larger stuff, or stuff that is downloaded, like assets that I’m not concerned about the user potentially getting their hands on, but maybe it was downloaded and instead of downloading it every time, I can just load from a saved location.

For storing online, which could be with a backend service or a database, I like to use these for data that maybe the player wants to play across devices or they delete the game or phone explodes and they can still get their saved data back.

So in the end, that’s just sort of a rough idea of how I determine what to use.