Invoke wont work

USE CODE TAGS:

Formatted for you:

using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour {
    bool gameHasEnded = false;
    public void EndGame ()
    {
        if (gameHasEnded == false)
        {
            gameHasEnded = true;
            Invoke("Restart", 1f);
        }
        void Restart()
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }
    }
}

I don’t even see how this code compiles… you have your Restart method defined inside your EndGame method.