I am stuck on how to save the player's amount of money. When I build the game in the exe as soon as I shutdown the game my money value gets lost. I want this money to be saved. I am using the following code in UnityEngine:
using UnityEngine.UI; using System.Collections;
namespace CompleteProject
{
public class MoneyManager : MonoBehaviour {
public static int money; // The player's money.
Text moneytext; // Reference to the Text component.
void Awake ()
{
// Set up the reference.
moneytext = GetComponent <Text> ();
money=print(PlayerPrefs.GetInt("Money"));
}
void Update ()
{
moneytext.text = "" + money;
PlayerPrefs.SetInt ("Money", money);
}
}
}