EditorPrefs Manual     Reference     Scripting  
Scripting > Editor Classes > EditorPrefs
EditorPrefs Class

Stores and accesses Unity editor preferences.

Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.

On Mac OS X, EditorPrefs are stored in ~/Library/Preferences/com.unity3d.UnityEditor.plist

On Windows, EditorPrefs are stored in the registry under the HKCU\Software\Unity Technologies\UnityEditor key

Class Functions
SetInt

Sets the value of the preference identified by key.

GetInt

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

SetFloat

Sets the value of the preference identified by key.

GetFloat

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

SetString

Sets the value of the preference identified by key.

GetString

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

SetBool

Sets the value of the preference identified by key.

GetBool

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

HasKey

Returns true if key exists in the preferences.

DeleteKey

Removes key and its corresponding value from the preferences.

DeleteAll

Removes all keys and values from the preferences. Use with caution.