using UnityEngine;
public class GameManager : MonoBehaviour
{
bool gameHasEnded = false;
public void EndGame() {
if (gameHasEnded == false)
{
gameHasEnded = true;
Debug.Log("Game Over");
Restart();
}
}
void Restart ()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
I get these erroer:
Assets\Scripts\GameManager.cs(23,32): error CS0103: The name ‘SceneManager’ does not exist in the current context
Assets\Scripts\GameManager.cs(23,9): error CS0103: The name ‘SceneManager’ does not exist in the current context
Eny sugjestions on how to fix it?
Hey!
You need to be using UnityEngine.SceneManagement in your script in order to preform this action.
using UnityEngine.SceneManagement; - Place this under your ‘using UnityEngine’ line and you should be good.