Unity - Scripting API: EditorPrefs.GetInt
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Submission failed
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Declaration
public static int GetInt(string key);
Declaration
public static int GetInt(string key, int defaultValue = 0);
Parameters
| Parameter | Description |
|---|---|
| key | Name of key to read integer from. |
| defaultValue | Integer value to return if the key is not in the storage. |
Returns
int The value stored in the preference file.
Description
Returns the value corresponding to key in the preference file if it exists.
If the value doesn't already exist in the preference file the function will return defaultValue.
Additional resources: SetInt.