How to quit game on double pressing back button?
I am trying to quit my game after pressing back button but its not working. Here is my code:
public Canvas quitMenu;
public Button startText;
// Use this for initialization
void Start ()
{
quitMenu = quitMenu.GetComponent<Canvas>();
startText = startText.GetComponent<Button>();
quitMenu.enabled = false;
}
void Update()
{
if (Input.GetKeyUp(KeyCode.Escape))
{
quitMenu.enabled = true;
}
}
public void exitPress()
{
quitMenu.enabled = true;
startText.enabled = false;
}
public void noPress()
{
quitMenu.enabled = false;
startText.enabled = true;
}
public void startLevel()
{
SceneManager.LoadScene("Scene1");
}
public void exitGame()
{
Application.Quit();
}
}
Comment
Your answer
Follow this Question
Related Questions
Problem with Application.Quit 2 Answers
Help with a Start Button 2 Answers
I want to Automatically resize/snap buttons to my panel but it isnt working 0 Answers
How to quit game in unity 1 Answer
Button to do two actions ?, 0 Answers