public void TogglePauseMenu() { if (pauseMenu) { pauseMenu.DestroySelf(); } else if (canvas) { Time.timeScale = 0.0f; var pauseMenuObject = GameObject.Instantiate(ResourceManager.GetUIElement("PauseMenu")); pauseMenu = pauseMenuObject.GetComponent <PauseMenu>(); pauseMenu.transform.SetParent(canvas.transform, false); var loadButton = pauseMenu.GetComponentInChildren <LoadButton>(); loadButton.relatedSceneName = SceneManager.GetActiveScene().name; } }
private void Awake() { _deathMenu = GameObject.Find("Canvas").GetComponent <Menu.PauseMenu>(); _health = MaxHealth; }