save file gone when update game(new feature)

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: save file gone when update game(new feature)

Post by Joel »

No problem, I always try my best to help even when it's not fully under our control.

You can use ES2.Exists to determine if your save exists at a given path. So if you have access to a device which has this issue, you should be able to use it with your filename appended to the paths above to see if they exist. Note you will need to replace mycompany, mygame and the uuid with your own where applicable.

You might also want to check if the original location was on the SD card, as Unity might be suddenly forcing it to use internal storage even when you've told it to use external storage. The location of this is:
/storage/sdcard0/Android/data/com.<companyname>.<productname>/files
You should then be able to use ES2.Rename to change the path of the old file to the new Application.persistentDataPath.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
yamada
Posts: 8
Joined: Sat Aug 13, 2016 1:32 pm

Re: save file gone when update game(new feature)

Post by yamada »

Hi there,

I heard important information from my app’s user. After he used the CleanMaster Lite (kind of file cleaning app of Android), all data of my app has gone. I can reproduce same phenomenon on my device. I wonder that save data on Application.persistentDataPath could be deleted by other apps? If it is true, using Application.persistentDataPath might be very danger.

By the way, almost my app's user's Application.persistentDataPath was below:
/storage/emulated/0/Android/data/com.<companyname>.<productname>/files
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: save file gone when update game(new feature)

Post by Joel »

Hi there,

Application.persistentDataPath is managed by Unity, so you will need to contact them regarding this.

However, the path you've included is specified by the Android specification as a safe place for storing persistent data, so the external app should not be removing data from there.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Phuzz
Posts: 14
Joined: Wed Jan 21, 2015 7:23 pm

Re: save file gone when update game(new feature)

Post by Phuzz »

kmsjkh wrote:thank joel
my gamers complains about this problem so many many many :( :x :x :x :x
finally i can solve this problem
i wish this problem will be solved in es3
I have the same problem too but I believe it is from Unity side, they delightfully dropped my game ratings significantly, I hope they solve the issue soon.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: save file gone when update game(new feature)

Post by Joel »

I've just found a this thread also, which says that Unity changes the location of Application.persistentDataPath if you change your permissions:
https://answers.unity.com/questions/115 ... -i-ad.html

People might also want to try accessing the internal storage using an absolute path using the code posted in that thread:
#if UNITY_ANDROID && !UNITY_EDITOR
     using (AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
     {
         using (AndroidJavaObject currentActivity = jc.GetStatic<AndroidJavaObject>("currentActivity"))
         {
             path = currentActivity.Call<AndroidJavaObject>("getFilesDir").Call<string>("getCanonicalPath");
         }
     }
 #endif
If anyone had a case which reproduces any of these issues, I would strongly recommend posting it on the Unity forums and filing a bug report, as they will be more likely to fix it quicker. I'm not able to reproduce it at my end so I'm not currently able to do so.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Locked