Playerprefs not saving on 3% of android phones

On 150 ratings, 5 of them gave me one star, telling me “the game doesn’t save”, but it does save on the vast majority of others. This happens on various phones (even on Galaxy S7), from OS4.4 to 6.0, but other players with the same phones/ same OS don’t have the problem.

I can’t debug this properly because :

  1. I can’t reproduce the problem
  2. and these players with the problem don"t answer my questions :-/

Some infos :

  1. I’m doing PlayerPrefs.Save(); just after all my PlayerPrefs.SetInt()
  2. I’m not doing these on a loop, not even doing these before an application.quit() , not even before an application.loadscene()
  3. And my app is 40Mo, if that does matter.

I can’t really believe it’s a memory failure because I’m only saving a few integers…
I’m thinking maybe these people have got an app that is deleting other app’s caches ? Does that exist ?
I really don’t know what to do here … Do you guys have any idea ?

P.S. question already posted by me there, but I’ve been told to seek help here instead.
PS.2 : Question also asked by this guy here. But no one found a solution.

I don’t even use the playerprefs.save() and it correctly saves, maybe they swapped the game from internal to SD card? Do you have the external storage permission ticked in the player settings?

Hey, No I hadn’t tried nor thought of that yet !

So I tried it :

  • I’ve moved the app on the SD card and I tried to save again -*** I haven’t put in the manifest or in Unity’s app’s settings any permission to write on the SD card. (it’s still the default “Write permission” - “Internal”) ***- : And it’s still saving properly !
    I’ve explored my files on the phone with a file manager and I saw that the cache is still located on the phone’s storage, when the app itself is located in the SD card.
    So I didn’t reproduce the problem on my phone by doing this.

Several questions appear :

  1. is that normal that playerpref is still saving on the phone’s storage when the app has been moved on the sd card ?
  2. And could it be that it’s not working the same way on all android phones ? (some phones would have playerprefs trying to save on the SD card, which would fail because it needs a permission ?)

If we assume it’s the problem … I don’t want all the players to to get the scary message warning you get by choosing “write permission - External SD Card” … It should happen only for those with this issue.

So I thought of trying the setting : “Install Location” - “Force internal” - but I 've found out that you can still, manually move the app on the SD card …
I’ve found that thread with people having these kind of difficulties with Sd card / internal storage issues (and no solution yet) :

Maybe it’s related to my problem … don’t know…

Hi. PlayerPrefs works fine for me. From 3300 ratings/comments from my players - no one was telling me about “the game doesn’t save”. May be you are saving to much data? (there is a limit for amount of data you can save using PlayerPrefs).

Hi. thanks for your reply.
No I’m only saving a few integers… 4 of them exactly.

This guy had the same issue :

“This is a special/weird/edge case we’re discussing :)” as he said.

This is surprising you never had this with 3300 ratings, though…

Hi Guillaumzed,

Did you find a solution or the cause of your problem, I have exactly the same and I search a solution :wink:

Thank by advance for your reply

Hi Nico,
I don’t receive anymore this kind of messages from the users of my game, so I don’t really know if it’s resolved or not.

My install/writte config in Publish settings - Other settings, is currently set like so :

  • Install Location : Automatic
  • Write Permission : Internal

I’ll tell you here if I got any news on this subject!
Good luck

1 Like

Ok thank you for the reply

Guys, any news on this?

One year later, the same thing happening with Unity 2018.2.9f1.

I remember i have lived the similar issue. When i used onapplicationquit event sometimes i had saveproblems. Try to save somewhere else in your code.