Unity常用函数注意事项

来源:互联网 发布:途虎软件下载 编辑:程序博客网 时间:2024/04/29 12:41

PlayerPrefs.GetInt 获取整数键值

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

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

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

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

music.SetActive(PlayerPrefs.GetInt("openMusic",1)==1?false:true);返回false;
PlayerPrefs.SetInt("openMusic",PlayerPrefs.GetInt("openMusic",1)==1?0:1);music.SetActive(PlayerPrefs.GetInt("openMusic",1)==1?false:true);

返回true;

0 0
原创粉丝点击