Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  3. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Bug Saved PlayerPrefs data gone with each editor restart

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

  1. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    375
    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:
    37
    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:
    654
    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:
    3
    Still happens on Unity 2017.4.9f1 (Linux Editor).............
     
  7. Bslashingu

    Bslashingu

    Joined:
    Sep 17, 2012
    Posts:
    20
    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