Space Shooter tutorial game won't restart
I get the error below and then I'm pointed to this code. The problem started after switched the GameController code to use the "UnityEngine.SceneManagement" function.
Now every time I press "R" to restart it turns off the Game Controller
Cannot find 'GameController' script UnityEngine.Debug:Log(Object) DestroyByContact:Start() (at Assets/Scripts/DestroyByContact.cs:24)
 void Start ()
     {
         GameObject gameControllerObject = GameObject.FindGameObjectWithTag ("GameController");
         if (gameControllerObject != null)
         {
             gameController = gameControllerObject.GetComponent <Done_GameController>();
         }
         if (gameController == null)
         {
             Debug.Log ("Cannot find 'GameController' script");
         }
     }
 
 using System.Collections;
 using UnityEngine;
 using UnityEngine.SceneManagement;
 
 public class GameController : MonoBehaviour 
 {
     public GameObject[] hazards;
     public Vector3 spawnValues;
     public int hazardCount;
     public float spawnWait;
     public float startWait;
     public float waveWait;
 
     public GUIText scoreText;
     public GUIText restartText;
     public GUIText gameOverText;
 
     private bool gameOver;
     private bool restart;
     private int score;
 
     void Start ()
     {
         gameOver = false;
         restart = false;
         restartText.text = "";
         gameOverText.text = "";
         score = 0;
         UpdateScore ();
         StartCoroutine (SpawnWaves ());
     }
 
     void Update ()
     {
         if (restart) 
         {
             if (Input.GetKeyDown (KeyCode.R))
             {
                 SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
             }
         }
     }
 
 
              I forgot to mention the Game Controller does have a tag on it
Answer by DoubleTapGamesMobile · Feb 14, 2018 at 12:32 AM
@machado_ i have just done this tutorial and replace SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
with
Application.LoadLevel(Application.loadedLevel); as specified in the tutorial and it worked for me
and take off using UnityEngine.SceneManagement;
hope this works
,I've got this problem too
Your answer