[2019.1] Playerprefs are cleared after reload on webgl

After the upgrade to 2019.1 all the saved settings are cleared when i reload the browser, this problem doesnt occure on ios and android. To be sure that there is not a bug in my project, i made a very simple test project where i simply save a playerpref and i trace it on reload and even there it doesnt work. Does somebody has an idea if this can be fixed somehow?

To write the playerpref i added this to a TMP_InputField

public class CookieTest : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("test "+PlayerPrefs.GetString("test"));
        GetComponent<TMP_InputField>().onSubmit.AddListener(OnSubmit);
    }

    private void OnSubmit(string text)
    {
        PlayerPrefs.SetString("test",text);
        Debug.Log("test "+PlayerPrefs.GetString("test"));
    }

}

and this to a Button

public class ReadCookie : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        GetComponent<Button>().onClick.AddListener(OnClick);
    }

    private void OnClick()
    {
        Debug.Log("test "+PlayerPrefs.GetString("test"));
    }
}

It’s the magic of releasing something without testing it :slight_smile:

1 Like