Answer the question
In order to leave comments, you need to log in
Why is saving via PlayerPrefs not working?
public void LoadNormalScene()
{
PlayerPrefs.SetInt("money", allVariables.money);
PlayerPrefs.Save();
SceneManager.LoadScene("Main");
}
public IEnumerator TimerStart()
{
for (float i = 0; i < time; i++)
{
yield return new WaitForSeconds(1f);
left = time - i;
timerText.text = "Осталось - " + left + "Секунд";
}
isStopped = true;
isStopped = false;
panelFinish.SetActive(true);
earned.text = works.howMuchEarn.ToString();
Debug.Log(works.howMuchEarn);
allVariables.money = NewMethod();
Debug.Log(allVariables.money);
}
private int NewMethod()
{
return allVariables.money + works.howMuchEarn;
}
private void Awake()
{
allVariables = GameObject.Find("Main Camera").GetComponent<AllVariables>();
if (PlayerPrefs.HasKey("money"))
{
allVariables.money = PlayerPrefs.GetInt("money");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question