Search Unity

Bug Saved PlayerPrefs data gone with each editor restart

Discussion in 'Linux' started by LukaKotar, Sep 17, 2015.

  1. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    PlayerPrefs seem to be correctly saved to ~/.config/unity3d/[company]/[product]. Once the editor is closed and re-opened, the PlayerPrefs data is gone (but the file remains intact). (By "gone" I mean that PlayerPrefs.HasKey("Key") returns false if the key wasn't saved in the current editor session.)

    (EditorPrefs works correctly though)
     
  2. Chaoseiro

    Chaoseiro

    Joined:
    Aug 28, 2013
    Posts:
    40
    Also happening here...
    Including Editor.log and Editor-prev.log.

    (My 2c: maybe the prefs file is created using "> prefs", thus being recreated every time the editor opens?)
     

    Attached Files:

  3. masterchop

    masterchop

    Joined:
    Oct 9, 2015
    Posts:
    39
    How can we fix this?? Its really annoying i cant move forward on my project.
    sometimes works fine and sometimes is not working as expected, there must be a way to really save stuff, it happens with all type of objects.
     
  4. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    You can use the System.IO namespace to be able to use File.WriteAllText and File.ReadAllText. Or you can learn the System.Xml stuff if you want to save in Xml.

    In the long term this is probably a better option anyway if you plan on making games on Steam that can use Steam Cloud.

    Just my 2c.
     
  5. biscuitseed

    biscuitseed

    Joined:
    Mar 30, 2016
    Posts:
    5
    This still happens - anyone got a temporary fix? Not too annoying of an issue, but a bit tedious nonetheless.
     
    Last edited: Jul 20, 2016
  6. rayfung_unity

    rayfung_unity

    Joined:
    May 26, 2016
    Posts:
    4
    Still happens on Unity 2017.4.9f1 (Linux Editor).............
     
  7. AmbOcclusion

    AmbOcclusion

    Joined:
    Sep 17, 2012
    Posts:
    33
    EditorPrefs and PlayerPrefs are broken for me in 2018.2.17f1 on Linux. Surprised this is going on for so many years...
     
    Last edited: Nov 28, 2018