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

EditorPrefs doesn't work on 2018.2.10 ?

Discussion in 'Scripting' started by BaptisteB, Oct 9, 2018.

  1. BaptisteB

    BaptisteB

    Joined:
    Mar 11, 2015
    Posts:
    12
    Hello everyone!
    Just try to use EditorPrefs in Unity 2018.2.10. Work well on a single project but doesn't when trying to get the prefs in another project, which is the purpose of editorPrefs right?


    Code (CSharp):
    1.  
    2.     void Start ()
    3.     {
    4.         Debug.Log(EditorPrefs.GetString("EditorPrefsTest"));
    5.     }
    6.      
    7.     void Set()
    8.     {
    9.         EditorPrefs.SetString("EditorPrefsTest", "WORK");
    10.     }
    11.  
    12.  
    13.    
    I use this code in 2 projects.
    In project one, I use the Set() to set up the value of EditorPrefsTest.
    In project two, I just launch it and the Start() function send an empty string.
     
  2. BaptisteB

    BaptisteB

    Joined:
    Mar 11, 2015
    Posts:
    12
  3. BaptisteB

    BaptisteB

    Joined:
    Mar 11, 2015
    Posts:
    12
    Yes both the same Unity version
     
  4. BaptisteB

    BaptisteB

    Joined:
    Mar 11, 2015
    Posts:
    12
  5. BaptisteB

    BaptisteB

    Joined:
    Mar 11, 2015
    Posts:
    12
    New test on 2018.2.18f on two projects.
    Still doesn't work.

    Any idea?
     
  6. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @BaptisteB I noticed this as well in 2019.1. Do you know what the issue was?
     
  7. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Also, I thought EditorPrefs were project dependent. Is that not the case?
     
  8. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    Yep, not working for me either, I'm trying to save something right before the EditorSceneManager.OpenScene, but upon checking the regedit, nothing is stored in the key.