I have the below script and once I press the back button on my Android the images pop up but immediately go away. How can I make them stay one of the two button is pressed?
if (Input.GetKeyDown(KeyCode.Escape)) {
quit1 = (Texture)Resources.Load("quit");
confirmbtn = (Texture2D)Resources.Load("confirmbtn");
nobutton = (Texture2D)Resources.Load("nobutton");
GUI.DrawTexture(new Rect(Screen.width/2, Screen.height/2, 400, 200), quit1, ScaleMode.StretchToFill, true, 10.0F);
GUI.skin.button.normal.background = confirmbtn;
GUI.skin.button.hover.background = confirmbtn;
GUI.skin.button.active.background = confirmbtn;
if (GUI.Button(new Rect(Screen.width/2 - 50,Screen.height/2 + 200,200,100), "")) {
Application.Quit();
}
GUI.skin.button.normal.background = nobutton;
GUI.skin.button.hover.background = nobutton;
GUI.skin.button.active.background = nobutton;
if (GUI.Button(new Rect(Screen.width/2 + 50,Screen.height/2 + 200,200,100), "")) {
paused = true;
}
StartCoroutine(waitforButton());
}
IEnumerator waitforButton() {
while (!paused) {
yield return null;
}
I have also tried doing a while statement. I did declare paused as false. Yes I know it is a bit backwards by standard of pausing, but any help would be appreciated.