Version: 2022.1
LanguageEnglish
  • C#

EditorPrefs

class in UnityEditor

Suggest a change

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.

Close

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.

Close

Cancel

Description

Stores and accesses Unity Editor preferences.

On macOS, EditorPrefs are stored in ~/Library/Preferences/com.unity3d.UnityEditor5.x.plist.

On Windows, EditorPrefs are stored in the registry under the HKCU\Software\Unity Technologies\Unity Editor 5.x key.

On Linux, EditorPrefs are stored in ~/.local/share/unity3d/prefs.

Static Methods

DeleteAllRemoves all keys and values from the preferences. Use with caution.
DeleteKeyRemoves key and its corresponding value from the preferences.
GetBoolReturns the value corresponding to key in the preference file if it exists.
GetFloatReturns the float value corresponding to key if it exists in the preference file.
GetIntReturns the value corresponding to key in the preference file if it exists.
GetStringReturns the value corresponding to key in the preference file if it exists.
HasKeyReturns true if key exists in the preferences file.
SetBoolSets the value of the preference identified by key.
SetFloatSets the float value of the preference identified by key.
SetIntSets the value of the preference identified by key as an integer.
SetStringSets the value of the preference identified by key. Note that EditorPrefs does not support null strings and will store an empty string instead.