PlayerPref not working, crashing

I ran a script with the suggestion of someone else:

public void Testing()
{
    Debug.Log((PlayerPrefs.HasKey("Username")));
    PlayerPrefs.SetString("UserName", "UserName");
    Debug.Log((PlayerPrefs.HasKey("Username")));

}

And I get 2 times a value of false in the console. How is this possible?

One of those commands isn’t working and is making the final code crash the game. Am I forgetting something?

It’s possible because your HasKey checks for "Username" and the SetString writes to a key called "UserName"

N != n