*Urgent* Google play App update = No save

Hey,

I just released my game and some few players reports that their saves gets deleted whenever they update the game from google play.
My beta testers didn’t have this issue. Maybe 1 of them but we thought it was other reasons.

It’s nothing worse than losing progression for no reason so I want to fix this asap if possible.

I use this for save (just example)

 BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(Application.persistentDataPath + "/playerInfo.dat");
        PlayerData data = new PlayerData();

and load:

if (File.Exists(Application.persistentDataPath + "/playerInfo.dat"))
        {
            BinaryFormatter bf = new BinaryFormatter();
            FileStream file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
            PlayerData data = (PlayerData)bf.Deserialize(file);
            file.Close();

I read that other people have this issue as well. it could be pathing issues (Application.persistentDataPath), android update issues etc but I haven’t found a solution yet.

Any idea what I could do?
Edit:
(Player settings)
Install location = Prefer External
Write Permission = Internal

I use S6 and have no issues.
My friend has S7 and his saves gets deleted.

I once had an issue where the persistantDataPath was changing after the first load. So we could start it up, play for the first play through and everything saved correctly. But then on the second playthrough, the game started fresh.

Used Unity Asset Store - The Best Assets for Game Making log viewer and had a debug that printed out what persistantDataPath was and the first time it pointed to one location I think on the internal card, but then because permission was granted, the second time, persistantdataPath pointed to the external card. This was on an older Android OS and using an older version of Unity since it was an update to the app, but similar thing could be happening to you, so I would try that and see what persistantdatapath points to.

Now, that being said, just updating from google play shouldn’t change things, so again, use something like log viewer and test on your friends device to maybe see what is happening.

Since we were just saving json strings, we just ended up switching to playerprefs to save the data and that was enough to fix it for us.

Other than that, not sure what would change for you.

Thanks for your responds and sharing your experience :slight_smile:
Did a small update yesterday and his save wasn’t deleted. I have a feeling it could be connected with updating from Alpha → Beta → Release. He responded saying his save was deleted after buying something from my store which doesn’t have any connection to the saves what so ever. It could have been a update as well thought. Troubleshooting others devices without seeing it yourself can be a pain.
will do some more digging however.
Thanks again!

Same thing happening to me. Did you ever solve this?

Unfortunately I ended up going back to PlayerPrefs. I changed my scripts so I didn’t have that much to save. Would be nice to know a solution for other projects.
Think I read that some people use PlayerPrefs to save the location of the files. Than load/save at that location. However I did not want to test that so I have no clue if it works.