title: Invoke Can't Be Called
body: <p>I am very new to Unity and C#, and am just starting to learn the basics. I made a simple game that has a cube moving forward, and if it hits an obstacle, the game restarts. However, when I try to use Invoke to delay the time after the game restarts when the cube collides, the restart is instant.</p>
  
  <p>I haven't been able to try much since I am still new to C# and Unity.</p>
  
  <p>This is my GameManager script:</p>
  
  <pre><code>using UnityEngine;
  using UnityEngine.SceneManagement;
  
  public class GameManager : MonoBehaviour
  {
      bool gameHasEnded = false;
      public float restartDelay = 3f;
  
      public void EndGame()
      {
  
          if (gameHasEnded == false)
          {
              gameHasEnded = true;
              Debug.Log("Game Over!");
              Invoke("Restart", restartDelay);
              Restart();
          }
      }
  
      void Restart()
      {
          SceneManager.LoadScene(SceneManager.GetActiveScene().name);
      }
  
  }
  </code></pre>
  
  <p>When the player collides with an object (Obstacle script):</p>
  
  <pre><code>using UnityEngine;
  
  public class PlayerCollision : MonoBehaviour
  {
  
      public PlayerMovement movement;
  
      void OnCollisionEnter(Collision collisionInfo)
      {
          if (collisionInfo.collider.tag == "Obstacle")
          {
              movement.enabled = false;
              FindObjectOfType&lt;GameManager&gt;().EndGame();
          }
      }
  
  }
  
  </code></pre>
  
  <p>I want the restart to be delayed so the game doesn't restart instantly. Any help would be greatly appreciated :)</p>