DiskSavedGameDataStorer for mobile
-
- Posts: 20
- Joined: Mon Jan 21, 2019 5:29 pm
DiskSavedGameDataStorer for mobile
Hello, I'm trying to find the best way to save my game's progress. I'm wondering why DiskSavedGameDataStorer does not support mobile? My game will be released for both PC and mobile platform. I'm hesitant to use PlayerPrefs because lots of web discussions say that it's bad practice. Do I have to write my own DataStorer? If so, I need to know how to get it to work for both PC and mobile. Thanks.
Re: DiskSavedGameDataStorer for mobile
Hi,
The next update will let you use DiskSavedGameDataStorer on mobile. If you want to use it right away, change line 19:
to:
However, if you're making an offline mobile game, saving to PlayerPrefs is a perfectly valid place to save. Concerns online are typically about size (saved games in PlayerPrefs have a 1 MB limit on some platforms), speed (PlayerPrefsSavedGameDataStorer is optimized, so this isn't a concern), and security (PlayerPrefsSavedGameDataStorer can encrypt, so this isn't a concern either).
The next update will let you use DiskSavedGameDataStorer on mobile. If you want to use it right away, change line 19:
Code: Select all
#if UNITY_EDITOR || UNITY_STANDALONE
Code: Select all
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_IOS || UNITY_ANDROID
-
- Posts: 20
- Joined: Mon Jan 21, 2019 5:29 pm
Re: DiskSavedGameDataStorer for mobile
Hi Tony,
I'm also concerned by this quote.
Are PlayerPrefs as easily to be lost through cache clearing as described in the above? If so, would DiskSave be better?
Also, When's the next update? How do I keep my version of Dialogue System updated(through play store)?
Thanks.
I'm also concerned by this quote.
https://gamedev.stackexchange.com/quest ... layerprefsIt is up to you, but on android at least it is very easy to reset these things on your phone. Most of the time it is best to save things that you do not want to lose externally so that the user cannot manipulate or delete it. I am not positive how easy it is to do on iOS, but on android all you have to do is go to the app in the application manager and clear the cache and it will remove all of those PlayerPrefs.
Are PlayerPrefs as easily to be lost through cache clearing as described in the above? If so, would DiskSave be better?
Also, When's the next update? How do I keep my version of Dialogue System updated(through play store)?
Thanks.
Re: DiskSavedGameDataStorer for mobile
Hi,
PlayerPrefs aren't cleared when you clear the cache. You only need to do a quick test to confirm. (I just did, BTW.) This manual page explains where PlayerPrefs are stored on various platforms and how they can and can't be cleared.
However, if the player uninstalls the app or goes into Settings > Apps > (your app) and selects Clear Data, they will lose their PlayerPrefs data as well as any disk-based saved games. Likewise if they lose their device. The only way to handle these cases is to store the data externally, such as on your server. And you could certainly write a saved game data storer to do that if you wanted. The nice thing about the Dialogue System's Save System is that you can use the PlayerPrefsSavedGameDataStorer while you're developing your game, and then later just swap it out with a different SavedGameDataStorer component without having to change anything else.
As far as preventing the player from manipulating data, as I mentioned before the PlayerPrefsSavedGameDataStorer and DiskSavedGameDataStorer both encrypt their data.
I just checked the version 2.1.0 DiskSavedGameDataStorer, and it does need some modifications to work on mobile. I'll try to make sure those changes are in version 2.1.1. When version 2.1.1 is available (scheduled for next week), you'll be able to import the update from the Asset Store.
PlayerPrefs aren't cleared when you clear the cache. You only need to do a quick test to confirm. (I just did, BTW.) This manual page explains where PlayerPrefs are stored on various platforms and how they can and can't be cleared.
However, if the player uninstalls the app or goes into Settings > Apps > (your app) and selects Clear Data, they will lose their PlayerPrefs data as well as any disk-based saved games. Likewise if they lose their device. The only way to handle these cases is to store the data externally, such as on your server. And you could certainly write a saved game data storer to do that if you wanted. The nice thing about the Dialogue System's Save System is that you can use the PlayerPrefsSavedGameDataStorer while you're developing your game, and then later just swap it out with a different SavedGameDataStorer component without having to change anything else.
As far as preventing the player from manipulating data, as I mentioned before the PlayerPrefsSavedGameDataStorer and DiskSavedGameDataStorer both encrypt their data.
I just checked the version 2.1.0 DiskSavedGameDataStorer, and it does need some modifications to work on mobile. I'll try to make sure those changes are in version 2.1.1. When version 2.1.1 is available (scheduled for next week), you'll be able to import the update from the Asset Store.
-
- Posts: 5
- Joined: Sun Dec 18, 2022 12:07 am
Re: DiskSavedGameDataStorer for mobile
Hello Where can I find the save file on android if I set the "store save files in : Data Path" ?
Re: DiskSavedGameDataStorer for mobile
Hi,
If you store in Data Path, it will be here:
https://docs.unity3d.com/ScriptReferenc ... aPath.html
If you store in Persistent Data Path (more common), it will be here:
https://docs.unity3d.com/ScriptReferenc ... aPath.html
If you store in Data Path, it will be here:
https://docs.unity3d.com/ScriptReferenc ... aPath.html
If you store in Persistent Data Path (more common), it will be here:
https://docs.unity3d.com/ScriptReferenc ... aPath.html
-
- Posts: 5
- Joined: Sun Dec 18, 2022 12:07 am
Re: DiskSavedGameDataStorer for mobile
Hmm when I get to the package folder of my game the only folder in that file location is cache and files and neither both have the save data
I tried to change the Data path to persistent data path
I tried to change the Data path to persistent data path
Re: DiskSavedGameDataStorer for mobile
Temporarily tick the Debug checkboxes on the SaveSystem and DiskSavedGameDataStorer components. When you save the game on Android, examine the logs. It will indicate the path.
Note: If you're using PlayerPrefsSavedGameDataStorer, the game will be saved here.
Note: If you're using PlayerPrefsSavedGameDataStorer, the game will be saved here.
-
- Posts: 5
- Joined: Sun Dec 18, 2022 12:07 am
Re: DiskSavedGameDataStorer for mobile
Ok I'll try it thanks for helping me sir