In my game there is a pause, which is called by the "Esc" key .
After the defeat, a layer pops up on top of the game that says "Game Over" .
Since this is a layer, not a new scene, the pause can work at the time of Game Overa .
Question: how to block Esc and then restore it? Any enabled ?
LifeManager Script:
void Update () { if (lifeCounter == 0) { gameOverScreen.SetActive(true); player.gameObject.SetActive(false); } theText.text = "x " + lifeCounter; if (gameOverScreen.activeSelf) { //тут блокируем клавишу *"Esc"*. waitAfterGameOver -= Time.deltaTime; } if(waitAfterGameOver < 0) { //тут разблокируем клавишу "Esc". Application.LoadLevel(mainMenu); } } Script PauseMenu:
using UnityEngine; using System.Collections; public class PauseMenu : MonoBehaviour { public string levelSelect; public string mainMenu; public bool isPaused; public GameObject pauseMenuCanvas; // Update is called once per frame void Update () { if (isPaused) { pauseMenuCanvas.SetActive (true); Time.timeScale = 0f; } else { pauseMenuCanvas.SetActive(false); Time.timeScale = 1f; } if(Input.GetKeyDown(KeyCode.Escape)) { isPaused = !isPaused; } } public void Resume() { isPaused = false; } public void LevelSelect() { Application.LoadLevel (levelSelect); } public void Quit() { Application.LoadLevel (mainMenu); } } 

isGameOverflag, which you do true / false when you need ..... and accordingly where you process theESCkey, write:if (isGameOver) return;that's all ...... - Alexey Shimansky