Question by
epameinondaspanos · Jul 22, 2020 at 05:57 PM ·
resetmoneyrestart gamemoneysystemcontinue
I need to fix a problem where my money resets when i continue to the next level
So i am having a problem where my money resets every time i restart or continue to the next level, and since i am trying to make an ads system i need to fix this issue, please help me i am desperate.
{ public static int Money; public int startMoney;
public static int Lives;
public int startLives;
public static int rounds;
void OnEnable()
{
Money = PlayerPrefs.GetInt("PlayerTotalMoney");
}
void Start()
{
Lives = startLives;
Money = startMoney;
rounds = 0;
}
void SaveCoins()
{
PlayerPrefs.SetInt("PlayerTotalMoney", Money);
PlayerPrefs.Save();
print(PlayerPrefs.GetInt("PlayerTotalMoney"));
}
}
Comment
Your answer
Follow this Question
Related Questions
money system in c# 0 Answers
reloading a scene after death - resetting scripts 1 Answer
Money not being added. 0 Answers
unity ads paying very low money with very less eCPM 0 Answers