Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

PlayerPrefs.GetInt

Switch to Manual
public static function GetInt(key: string, defaultValue: int = 0): int;

Parameters

Description

Returns the value corresponding to key in the preference file if it exists.

If it doesn't exist, it will return defaultValue.

	print (PlayerPrefs.GetInt("Player Score"));