Search Unity

I need help with UnityEngine.SceneManagement

Discussion in 'Getting Started' started by Plague_Doctor13, Feb 16, 2020.

  1. Plague_Doctor13

    Plague_Doctor13

    Joined:
    Feb 16, 2020
    Posts:
    2
    I am using the newest version of unity:
    I am making a 3D game.
    I started yesterday so I am sorry if I am confused.


    using UnityEngine;
    using UnityEngine.SceneManagement;

    public class Gamemanager : MonoBehaviour
    {
    bool gameHasEnded = false;

    public void Endgame ()
    {
    if (gameHasEnded == false){

    gameHasEnded = true;
    Debug.Log("get rekt you pleb");
    Restart();
    }

    }

    void Restart ()
    {
    SceneManagement.LoadScene("Level01");
    }


    }

    This is the code I am trying to make it so it restarts the level my problem is every time I run my game it does not start and the error
    "Assets\Hard script\Gamemanager.cs(22,5): error CS0103: The name 'SceneManagement' does not exist in the current context
    "
    occurs what do I do what do I fix?
     
  2. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,205
    JoeStrout likes this.
  3. Plague_Doctor13

    Plague_Doctor13

    Joined:
    Feb 16, 2020
    Posts:
    2