79427138

Date: 2025-02-10 13:01:53
Score: 2
Natty:
Report link

In your RestartGameButton class just return after this line

GameManager.instance.RestartGame();

because after this line your code continues to this line

SceneLoader.LoadScene(2);

and this line is loading scene in index 2 in single mode which will remove all loaded scenes

But if you want to load the load scene on index 2 then you have to update your scene loader to hold a list of loaded scenes and unload loaded scenes first and then load new scenes and while doing this just exclude your PersistentScene scene

On top of this I would recommend you to watch this tutorial

Reasons:
  • Blacklisted phrase (1): this tutorial
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Aditya