when i press android button it exits, but i want it should ask exit yes or no
how can this be done ?
when i press android button it exits, but i want it should ask exit yes or no
how can this be done ?
I messaged you on Skype, but for those who also may be interested,
You can create another if statement within that one, that displays a box with two buttons. One being yes and one being no. You should create a bool for ExitApp and set it to false. If it’s true, go ahead and exitApplication. else, return.
In your GUI function, you will do the check for the bool.
if (exitApp = true)
{
application.quit();
}
if input.getkey(key code.exscape)
showMenuForQuit = true;
Also in your GUI function, you’ll need another bool. One for showMenuforQuit. if it’s true, display the box with buttons, else return.
Best,
Jon
I am trying to manage it like this -
if (Input.GetKey(KeyCode.Escape))
{
Time.timeScale = 0.0f; // paused the game
if (GUI.Button(new Rect(230, 440, 500, 50), "QUIT")){
Application.Quit();}
else if (GUI.Button(new Rect(230, 495, 500, 50), "NO")){
Debug.Log("didnt quit");
Time.timeScale = 1.0f; // resumed the game
}
}
what should i write in else if, so that it returns to game scene and hide these buttons?