Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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:
    20,193
    JoeStrout likes this.
  3. Plague_Doctor13

    Plague_Doctor13

    Joined:
    Feb 16, 2020
    Posts:
    2