Version: 2022.2

EditorPrefs

class in UnityEditor

切换到手册

描述

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.

静态函数

DeleteAll从偏好中删除所有键和值。请谨慎使用。
DeleteKey从偏好中删除 key 及其对应值。
GetBool返回偏好设置文件中与 key 对应的值(如果存在)。
GetFloat返回偏好设置文件中与 key 对应的浮点值(如果存在)。
GetInt返回偏好设置文件中与 key 对应的值(如果存在)。
GetString返回偏好设置文件中与 key 对应的值(如果存在)。
HasKey如果偏好设置文件中存在 /key/,则返回 true。
SetBool设置由 key 标识的偏好的值。
SetFloat设置由 key 标识的偏好设置的浮点值。
SetInt将由键标识的偏好设置的值设置为整数。
SetString设置由 key 标识的偏好设置的值。请注意,EditorPrefs 不支持 null 字符串,而是存储空字符串。
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961