嘿所以我嘗試了unitys Playerprefs方法,不知怎麼,它不會保存硬幣,當我關閉並退出遊戲,它不會將它保存...PlayerPrefs不工作
public Text CoinsText;
public int Coins;
public int clicks;
void Start()
{
PlayerPrefs.GetInt("Coins", Coins);
}
void Update()
{
CoinsText.text = "Memes: " + Coins;
if (Input.GetMouseButtonDown(0))
{
PlayerPrefs.SetInt("Coins", Coins);
Coins += clicks;
}
}
}
你不應該指派PlayerPrefs.GetInt(「Coins」,Coins);硬幣?我從來沒有使用過玩家首選項,但我猜它只返回一個值? – Alox
獲取int將加載它 –