A distinction of what PlayerPrefs is

From what I understand, a “PlayerPref” is supposed to save data relevant to the player. However, I’m somewhat confused by the name. Is it supposed to save the player’s system preferences, or is it used for more than that (e.g. “Player Score”)?

@017Bluefield The word “Player” here refers to the Unity Player, so in the context of your question, that would be the system preferences.

I have used Player.prefs to store local user information, so it can be used for that, as well as client settings. Basically anything you want to store and retrieve you can set via Player.prefs.

My Start() method contains a little PlayerPrefs script to assess where exactly the Character is at, but you can use it for whatever you like.

if (PlayerPrefs.GetString ("character_" + username) != "") {
			woodcutting = PlayerPrefs.GetInt ("woodcutting_level_" + username);
			woodcutting_xp = PlayerPrefs.GetInt ("woodcutting_xp_" + username);
			woodcutting_xp_required = PlayerPrefs.GetInt ("woodcutting_xp_required_" + username);

			attack = PlayerPrefs.GetInt ("attack_level_" + username);
			attack_xp = PlayerPrefs.GetInt ("attack_xp_" + username);
			attack_xp_required = PlayerPrefs.GetInt ("attack_xp_required_" + username);

			Vector3 loaded_pos = new Vector3(PlayerPrefs.GetFloat ("character_pos_x_" + username), PlayerPrefs.GetFloat ("character_pos_y_" + username), PlayerPrefs.GetFloat ("character_pos_z_" + username));

			transform.position = loaded_pos;

		}

Of course, there are many different ways of doing this.

PlayerPrefs has many different uses. Depends how creative you are.

It also works across a few platforms I have found. Stores and retrieves information successfully on my mac, pc, and in ios. Not sure about browsers or android.

If you needed to set a variable you’d do something like…

attack_xp_required = PlayerPrefs.SetInt ("attack_xp_required_" + username, "{VALUE}");