Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

PlayerPrefs deleted after IOS app update

Discussion in 'iOS and tvOS' started by totiherms, Jun 23, 2015.

  1. totiherms

    totiherms

    Joined:
    Oct 7, 2014
    Posts:
    4
    Hi,

    I lost my PlayerPrefs after updating the game on iOS. I don't understand the cause of this issue, because I don't make any reset on PlayerPrefs on code, and previous update didn't has this issue. What could be the reason? In this update I added OneSignal as Push notification service

    Thanks in advance

    jordi
     
  2. gdeglin

    gdeglin

    Joined:
    Mar 7, 2013
    Posts:
    78
    I think this could happen if you modify some values of PlayerPrefs, but then you don't call PlayerPrefs.Save and the application crashes or is force closed (such as when updating the game), so the changes are never saved. Calling PlayerPrefs.Save() after making any important changes to PlayerPrefs should prevent this problem.

    The documentation for the Save method talks about this: http://docs.unity3d.com/ScriptReference/PlayerPrefs.Save.html
     
  3. totiherms

    totiherms

    Joined:
    Oct 7, 2014
    Posts:
    4
    Thanks, but the PlayerPrefs have been deleted in all iOS devices... In android there's no issue
     
  4. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    Which version of Unity are you using?
     
  5. GForceArjun

    GForceArjun

    Joined:
    Apr 30, 2015
    Posts:
    2
    Facing the same problem. On iOS update, player prefs got deleted, causing collected coins, and other in game goods along with tutorial states got cleared. We were using Unity 5.1.1.f1 when we encountered this problem.
     
  6. exerion

    exerion

    Joined:
    Jun 29, 2011
    Posts:
    54
    This topic is a little old but we're experiencing the same issue. Users are reporting that all game progress is lost after installing an update. We haven't been able to reproduce it. We've been experiencing this issue on both iOS and Android intermittently since Oct 2015. We're often at the latest patch.

    gdeglin - Have you been able to reproduce this issue? We will attempt to reproduce this problem based on the conditions you described.

    Thanks :)
     
  7. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    We would be interested in any information you can find. Unfortunately we could not reproduce the problem either.
     
  8. exerion

    exerion

    Joined:
    Jun 29, 2011
    Posts:
    54
    In our situation I think what's happening is the game is crashing and somehow causing the app container to be reset. The user does an update, starts the game up and all their progress is lost so they blame the update.

    I have personally only seen our game crash on 2 occasions where upon restart the app container has been reset. We save some things to player prefs and our players progress to a file, it all gets erased.

    This doesn't happen often but when you have thousands of people playing your game everyday the reports start to add up.

    I have setup a couple of test projects to try and reproduce this bug but haven't had any success :(
     
  9. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427