// Update is called once per frame void Update() { if (Input.GetButtonDown("Cancel") || Input.GetButtonDown("Submit")) { if (!_paused) { Time.timeScale = 0; if (speedrunTimer != null) { if (speedrunTimer.activeSelf) { Speedrun.StopTimer(); Debug.Log("Stop"); } } _paused = true; } else if (_paused) { Time.timeScale = 1; if (speedrunTimer != null) { if (speedrunTimer.activeSelf) { Speedrun.RestartTimer(); Debug.Log("Restart"); } } _paused = false; } } }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); return; } else { _instance = this; } DontDestroyOnLoad(this.gameObject); }