Hey,

I’m saving the last level the player started to the playerprefs. code:

public int lastLevel;
public int currentLevel;

void Awake(){
currentLevel = SceneManager.GetActiveScene().buildIndex;
        if (currentLevel > lastLevel)
        {
            lastLevel = currentLevel;
            PlayerPrefs.SetInt("lastLevel", lastLevel);
        }
}

Then in the menu, I load these values again:
public int level;

    private void Awake()
    {
        level = PlayerPrefs.GetInt("LastLevel");
    }

This way I can click ‘continue’ and start the level where the player left.
But for some reason the main menu always loads ‘2’ as a value.

Does anyone have a clue why this happens?
I have tried putting it all in Start() or even Update(), but it didn’t fix it.

“lastLevel” != “LastLevel”