Hey I am making a gameover screen for my game. I want it to get gameover screen, then when player dies it restarts that level. I made it in a inefficient way making multiple gameover screens then connecting each gameover to their scene so it could restart that scene. My problem is that it still goes to my main level and skips tutorial. Code:
if (health == 0)
{
if (SceneManager.GetActiveScene() == SceneManager.GetSceneByName("Level 2 - Damages"))
SceneManager.LoadScene("Gameover 1");
if (SceneManager.GetActiveScene() == SceneManager.GetSceneByName("Level 3 - Wall Climbing"))
SceneManager.LoadScene("Gameover 2");
if (SceneManager.GetActiveScene() == SceneManager.GetSceneByName("Level 4 - FallingPlatform"))
SceneManager.LoadScene("Gameover 3");
if (SceneManager.GetActiveScene() == SceneManager.GetSceneByName("Level 5 - Buttons And Switches"))
SceneManager.LoadScene("Gameover 4");
if (SceneManager.GetActiveScene() == SceneManager.GetSceneByName("Final Level"))
SceneManager.LoadScene("Gameover");
}