PlayerPrefs.GetFloat 获取浮点键值

static function GetFloat (key : string, defaultValue : float = 0.0F) : float

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.GetFloat("Player Score"));
	}
}
print (PlayerPrefs.GetFloat("Player Score"));
Page last updated: 2012-5-27