Hey! I’ve been working on this for almost 2 weeks now, and it STILL won’t work! Can someone tell me what I’m doing wrong?
// Use this for initialization
void Awake () {
PlayerPrefs.GetInt("level", 0);
}
private void OnApplicationQuit()
{
PlayerPrefs.SetInt("level", Level);
PlayerPrefs.Save();
}
Yup! This worked! I had some issues, but was eventually get it to work! For some reason it won’t let me say that’s the answer, so I’ll just put my code here:
void Awake()
{
Debug.Log(Level = PlayerPrefs.GetInt("level", Level));
Level = PlayerPrefs.GetInt("level", Level);
}
private void OnApplicationQuit()
{
Debug.Log("OnApplicationQuit");
PlayerPrefs.SetInt("level", Level);
PlayerPrefs.Save();
}
private void OnApplicationFocus(bool focus)
{
Debug.Log("OnApplicationFocus " + focus);
}
private void OnApplicationPause(bool pause)
{
Debug.Log("OnApplicationPause " + pause);
PlayerPrefs.SetInt("level", Level);
PlayerPrefs.Save();
}
private void OnDestroy()
{
Debug.Log("OnDestroy");
}
private void OnDisable()
{
Debug.Log("OnDisable");
}