- Home /
Keycode.Escape in loop?,key.Escape in a loop
The code here is for quiting from main menu. But it runs only once. I want to run it whenever i press the androids h/w back button. Here's the code: void Update () {
if(Input.GetKeyDown(KeyCode.Escape))
{
if (!isQuit)
{
isQuit = true;
QuitMenu.SetActive(true);
}
else
{
QuitMenu.SetActive(false);
}
}
},The code below runs only once, i want it to run whenever i press the androids h/w back buton.
Here's the code:
void Update () {
if(Input.GetKeyDown(KeyCode.Escape)) { if (!isQuit) { isQuit = true; QuitMenu.SetActive(true); } else { QuitMenu.SetActive(false); } }
}
Comment
Where did you assign Quit$$anonymous$$enu? Show me your full code.
Your answer
Follow this Question
Related Questions
How to make a simple AI escape script? 2 Answers
Pause Game 1 Answer
input question 1 Answer
how do make the escape key make you leave the game 1 Answer
Exit application 3 Answers