private void Update() { if (currentState == GameState.Dead) { if (retryText) { retryText.SetActive(true); } if (Input.GetKey(KeyCode.R)) { //restart the current scene shipFactory.Unload(); projectileFactory.Unload(); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } else if (Input.GetKey(KeyCode.Q)) { shipFactory.Unload(); projectileFactory.Unload(); Application.Quit(); } } }