Search Unity

[Bug] PlayerPrefs are deleted when I restart my app

Discussion in 'Windows' started by Wadjey, Sep 25, 2016.

  1. Wadjey

    Wadjey

    Joined:
    Feb 4, 2015
    Posts:
    244
    Hi,
    My project and PlayerPrefs was running fine with Unity 5.4.1f1, but when I upgraded my project to Unity 5.4.1p2 (without changing anything in the code) the PlayerPrefs started being deleted every time I restart my app (when my app is running the PlayerPrefs is saving values ok, but when I close my app and reopen it all PlayerPrefs are lost).

    This bug is happening only with Windows 10/8.1 Universal, PlayerPrefs are working OK with Android and no date are lost when I restart my app.

    Please to take a look at this issue and find what you introduced in Unity 5.4.1p2 that breaking the PlayerPrefs for UWP/WSA.

    Bug case: 835218


    Thanks
     
    MrEsquire likes this.
  2. JariHuomo

    JariHuomo

    Joined:
    Feb 8, 2013
    Posts:
    48
    I have had similar but different problems with PlayerPrefs too on Windows 10 with 5.3 versions.

    In-App Purchases unlocks the full version:

    PlayerPrefs.SetInt("package_1_bought",1);
    PlayerPrefs.Save();

    Working fine.

    But I have received at least over 20 emails so far that after few weeks,
    full version is no longer unlocked. For some reason PlayerPrefs had lost the data, no idea why. Does not happen on other platforms. Had to made different way to save unlocking.
     
  3. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    I hope they check this ASAP, holding my update release until this and the random freeze error is fixed.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    We checked it first thing on Monday since the report sounds really scary. However, we could not reproduce it. It works fine on our end, and @Wajdik didn't send us a repro project :\.
     
  5. Wadjey

    Wadjey

    Joined:
    Feb 4, 2015
    Posts:
    244
    Hi,
    Any hope to get this bug fixed in this week patch release? If no, there is a temporary workaround for this issue? (I tried deleting Library folder but it didn't solved the issue for me)
     
  6. Ignas83

    Ignas83

    Unity Technologies

    Joined:
    Mar 26, 2013
    Posts:
    28
    We have finally received repro project and the fix is in place. We'll try to get it out with patch release ASAP. There's no trivial workaround unfortunately as preferences file gets overwritten on startup every time. Nontrivial workaround is to save preferences in a custom file.
     
    Wadjey likes this.
  7. JariHuomo

    JariHuomo

    Joined:
    Feb 8, 2013
    Posts:
    48
    Anyone tested are PlayerPrefs working with 5.4.2 ? :)
     
  8. Wadjey

    Wadjey

    Joined:
    Feb 4, 2015
    Posts:
    244
    No it still not fixed in v5.4.2f1
     
    JariHuomo likes this.
  9. illuminat

    illuminat

    Joined:
    Jul 2, 2014
    Posts:
    40
    same problem here... everything works in 5.3p6 but playerprefs are cleared in unity 5.4 versions

    @Ignas83 do you have an ETA for the patch?
     
  10. Ignas83

    Ignas83

    Unity Technologies

    Joined:
    Mar 26, 2013
    Posts:
    28
    Should be fixed in 5.4.2p1. I've asked QA to double check on this.
     
  11. trinhanhminh1405

    trinhanhminh1405

    Joined:
    Jun 5, 2014
    Posts:
    1
    this is 3/11/2016 and i'm still facing this bug in 5.4.2 on Windows App.
    Any news on this?
     
  12. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Did you not read above? try and download latest patch release and test