UNITY 5.2 PlayerPrefs类

来源:互联网 发布:互联网数据分析平台 编辑:程序博客网 时间:2024/05/22 06:35
public static void DeleteAll();

说明:删除所有内容


public static void DeleteKey(string key);

说明:删除 key 和 key 对应的 value


public static float GetFloat(string key);
public static float GetFloat(string key, float defaultValue);

说明:返回 key 对象的 value,若 key 不存在则返回 默认值 0.0f, defaultValue 设置默认值。


public static int GetInt(string key);
public static int GetInt(string key, int defaultValue);

说明:返回 key 对象的 value,若 key 不存在则返回 默认值 0, defaultValue 设置默认值。


public static string GetString(string key);
public static string GetString(string key, string defaultValue);

说明:返回 key 对象的 value,若 key 不存在则返回 默认值 “”, defaultValue 设置默认值。


public static bool HasKey(string key);

说明:是否有 key


public static void Save();

说明:保存刚修改的数据,程序退出时会默认调用。


public static void SetFloat(string key, float value);

说明:设置 key 的值为 float 类型的 value


public static void SetInt(string key, int value);

说明:设置 key 的值为 int 类型的 value


public static void SetString(string key, string value);
说明:设置 key 的值为 string 类型的 value
0 0
原创粉丝点击