- Home /
Question by
SterlingStudios · Feb 13, 2015 at 07:09 PM ·
javascriptgameplayerprefssavemoney
PlayerPrefs not working for different scenes
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!
Comment
Best Answer
Answer by SterlingStudios · Feb 13, 2015 at 08:41 PM
Sorry about this one... I was using the wrong key :(...
Your answer
Follow this Question
Related Questions
player prefs, problem but no problem??? 1 Answer
playerprefs problem 0 Answers
Playerprefs Question 0 Answers
Need help with PlayerPrefs 2 Answers
Help with Saving ArrayPrefs 0 Answers