using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour {
bool gameHasEnded = false;
public float restartDelay = 1f;
public void EndGame ()
{
if (gameHasEnded == false)
{
gameHasEnded = true;
Debug.Log("GAME OVER!");
Invoke("Restart", restartDelay);
}
}
void Restart ()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
when I use this code it pops up with the errors
Assets\scripts\GameManager.cs(6,14): error CS0101: The namespace ‘’ already contains a definition for ‘GameManager’
Assets\scripts\GameManager.cs(12,17): error CS0111: Type ‘GameManager’ already defines a member called ‘EndGame’ with the same parameter types
Assets\scripts\GameManager.cs(22,10): error CS0111: Type ‘GameManager’ already defines a member called ‘Restart’ with the same parameter types
If someone could tell me what’s wrong with this code, it would mean a lot.