unity, PlayerPrefs.GetInt(key,defaultValue)

PlayerPrefs.GetInt(key,defaultValue)中的defaultValue参数非常有用,因为玩家第一次玩的时候存档还没有建立。所以需要使用defaultValue参数,相当于为playerPrefs进行初始化。

原文地址:https://www.cnblogs.com/wantnon/p/4728098.html