Search Unity

Playerprefs return empty string

Discussion in 'Editor & General Support' started by Cascho01, May 13, 2019.

  1. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Hi,

    this code return an empty string (Unity 2019.1.0f2):
    Code (CSharp):
    1.     void Update()
    2.     {
    3.  
    4.         // GET:
    5.         if (Input.GetKeyDown(KeyCode.G))
    6.             print("Path: " + PlayerPrefs.GetString("Path"));
    7.  
    8.         // SET:
    9.         if (Input.GetKeyDown(KeyCode.S))
    10.         {
    11.             PlayerPrefs.SetString("Path", "Hello");
    12.             PlayerPrefs.Save();
    13.         }
    14.     }
    Any idea?


    EDIT: Strange, same code works now, will check this later
     
    Last edited: May 13, 2019