Hi, I’m making an arcade shooter game. You start in the main menu, like most games, however when I try to call the PlayerPrefs key “Money” it shows as 0. You earn score in the scene after the main menu, so how can I make a PlayerPrefs value global?
Here is the MoneyManager.js:
#pragma strict
var money : int;
function Start () {
money = PlayerPrefs.GetInt("Money");
}
function Update () {
PlayerPrefs.SetInt("Money", money);
PlayerPrefs.Save();
}
And here is MoneyDisplay.js:
#pragma strict
var money : int;
function Update () {
money = PlayerPrefs.GetInt("Money");
guiText.text = "$" + money;
}
Any help would be greatly appreciated!