I am just trying to provide the option of two buttons that will pause the game. P or Escape. However it seems as though escape is not working? There is no errors What is the best way to give the option of pausing the game with two separate buttons? Thank you.
using UnityEngine;
using System.Collections;
public class PauseP : MonoBehaviour {
bool paused = false;
private GameOverScriptP PauseMenu;
void Start ()
{
PauseMenu = GetComponent<GameOverScriptP> ();
}
void Update (){
if(Input.GetKeyDown (KeyCode.P))
if (Input.GetKeyDown(KeyCode.Escape))
{
if(!paused){
Time.timeScale = 0;
paused=true;
PauseMenu.enabled = true;
}else{
Time.timeScale = 1;
paused=false;
PauseMenu.enabled = false;
}
}
}
}