PlayerPrefs.GetString 获取字符串键值

static function GetString (key : string, defaultValue : string = "") : string

Description描述

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

如果存在,返回游戏存档文件中key对应的值。

If it doesn't exist, it will return defaultValue.

如果不存在,将返回默认值。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	public void Awake() {

		print(PlayerPrefs.GetString("Player Name"));

	}

}
print (PlayerPrefs.GetString("Player Name"));
Page last updated: 2012-5-27