This javascript is men't to make a toggle game menu but when i press ESC nothing happens. I have tried other key combos as well. I am sure its something simple. Any help would be much appreciated.
renderer.enabled = false;
gui = false;
function update ()
//this enables a plane in front of the camera to be visable and pauses the game after pressing ESC
{
if(Input.GetKeyDown("escape")){
renderer.enabled = true;
Time.timescale = 0;
gui = true;
}
// if you press ESC again it will un-pause the game and turn the plane to invisible
if(gui && Input.GetKeyDown("escape")){
renderer.enabled = false;
Time.timescale = 1;
gui = false;
}
}
↧