Unity入门操作_PlayerPrefs存储_037
来源:互联网 发布:ios10越狱软件源 编辑:程序博客网 时间:2024/06/16 19:03
任何前端都会有临时存储的机制,PlayerPrefs存储机制保密性差,所以一般情况下用在单机游戏存储。
static function DeleteAll(): void
描述:从设置文件中移除所有键和值,谨慎的使用它们。
static function DeleteKey(key: string): void
描述:从设置文件中移除key和它对应的值。
static function GetFloat(key: string, defaultValue: float=OF): float
描述:如果存在,返回设置文件中key对应的值.如果不存在,它将返回defaultValue。
static function GetInt(key: string, defaultValue: int): int
描述:返回设置文件中key对应的值,如果存在.如果不存在,它将返回defaultValue。
static function GetString(key: string, defaultValue: string=**): string
描述:返回设置文件中key对应的值,如果存在.如果不存在,它将返回defaultValue.
static function HasKey(key: string): bool
描述:在设置文件如果存在key则返回真.
static function SetFloat(key: string, value: float): void
描述:设置由key确定的值.
static function SetInt(key: string, value: int): void
描述:设置由key确定的值.
static function SetString(key: string, value: string): void
描述:设置由key确定的值.
using UnityEngine;
using System.Collections;
public class Test01 : MonoBehaviour {
// Use this for initializationvoid Start () { if (PlayerPrefs.HasKey("aa")) { Debug.Log(PlayerPrefs.GetString("aa")); } else { Debug.Log("不存在"); PlayerPrefs.SetString("aa","100"); } }// Update is called once per framevoid Update () {}
}
namespace UnityEngine
{
//// 摘要:// ///// Stores and accesses player preferences between game sessions.// ///public sealed class PlayerPrefs{ public PlayerPrefs(); // // 摘要: // /// // Removes all keys and values from the preferences. Use with caution. // /// [WrapperlessIcall] public static void DeleteAll(); // // 摘要: // /// // Removes key and its corresponding value from the preferences. // /// // // 参数: // key: [WrapperlessIcall] public static void DeleteKey(string key); // // 摘要: // /// // Returns the value corresponding to key in the preference file if it exists. // /// // // 参数: // key: // // defaultValue: [ExcludeFromDocs] public static float GetFloat(string key); // // 摘要: // /// // Returns the value corresponding to key in the preference file if it exists. // /// // // 参数: // key: // // defaultValue: [WrapperlessIcall] public static float GetFloat(string key, [DefaultValue("0.0F")] float defaultValue); // // 摘要: // /// // Returns the value corresponding to key in the preference file if it exists. // /// // // 参数: // key: // // defaultValue: [ExcludeFromDocs] public static int GetInt(string key); // // 摘要: // /// // Returns the value corresponding to key in the preference file if it exists. // /// // // 参数: // key: // // defaultValue: [WrapperlessIcall] public static int GetInt(string key, [DefaultValue("0")] int defaultValue); // // 摘要: // /// // Returns the value corresponding to key in the preference file if it exists. // /// // // 参数: // key: // // defaultValue: [ExcludeFromDocs] public static string GetString(string key); // // 摘要: // /// // Returns the value corresponding to key in the preference file if it exists. // /// // // 参数: // key: // // defaultValue: [WrapperlessIcall] public static string GetString(string key, [DefaultValue("\"\"")] string defaultValue); // // 摘要: // /// // Returns true if key exists in the preferences. // /// // // 参数: // key: [WrapperlessIcall] public static bool HasKey(string key); // // 摘要: // /// // Writes all modified preferences to disk. // /// [WrapperlessIcall] public static void Save(); // // 摘要: // /// // Sets the value of the preference identified by key. // /// // // 参数: // key: // // value: public static void SetFloat(string key, float value); // // 摘要: // /// // Sets the value of the preference identified by key. // /// // // 参数: // key: // // value: public static void SetInt(string key, int value); // // 摘要: // /// // Sets the value of the preference identified by key. // /// // // 参数: // key: // // value: public static void SetString(string key, string value);}
}
- Unity入门操作_PlayerPrefs存储_037
- Unity入门操作_Input_005
- Unity入门操作_025_01
- Unity入门操作_UGUI_InputFie_026
- Unity入门操作_UGUI_Toggle_027
- Unity入门操作_UGUI_Slider_028
- Unity入门操作_UGUI_ScrollBar_029
- unity - 二进制文件操作-存储与读取
- Unity入门操作_向量_002
- Unity入门操作_Transform组件_003
- Unity入门操作_Transform组件_003-01
- Unity入门操作_Time类_004
- Unity入门操作_旋转_006
- Unity入门操作_ 规律移动_007
- Unity入门操作_积木_009
- Unity入门操作_刚体 _012
- Unity入门操作_碰撞器 _013
- Unity入门操作_ 角色控制器_015
- jniLibs
- mysql 中时间日期格式datetime和timestamp比较 以及date_format函数
- AdversarialNetsPapers
- 四种Cast
- Redis集合(set)的命令操作
- Unity入门操作_PlayerPrefs存储_037
- 如何取消eclipse中编辑窗口上方的导航条
- Spring加载properties文件的两种方式
- mysql:bigint
- maven包大全 deeplearning4j
- 哈希表:Hash table
- struct和typedef struct
- 递归
- JavaNote1