Androud quit on doubletap escape

Okay,so I have

public bool quitBool = false;

#try 1
void Update () {

//if (Input.GetKeyUp(KeyCode.Escape))Application.Quit();

if (Input.GetKeyDown(KeyCode.Escape) && quitBool == true){
	Application.Quit();
}

if (Input.GetKeyUp(KeyCode.Escape))quitBool = true;
	else quitBool = false;

}

#try 2
if(Input.touchCount > 1)quitBool = false;

if(Input.anyKey){
	if (Input.GetKeyUp(KeyCode.Escape))quitBool = true;
			else quitBool = false;
        }

if (Input.GetKeyDown(KeyCode.Escape) && quitBool == true){
	Application.Quit();
}

I can’t seem to have it quit on doubletap. I tried having it quit on both GetKeyUp and GetKeyDown in both instances,then realised that the sequcence is key down->key up->key down->key up ,so i should be listening for the middle two,key down into key up right? But still doesn’t seem to work,anyone got an idea of what is going on here?

#Soultuon

okay,this seems to work

	if(Input.touchCount > 1)quitBool = false;

	if (Input.GetKeyDown(KeyCode.Escape) && quitBool == true){
		Application.Quit();
	}

	if(Input.anyKey){
			if (Input.GetKey(KeyCode.Escape))quitBool = true;
				else quitBool = false;
	}

Hopefully someone finds it useful //thread :slight_smile:

Found what works,added it up :slight_smile: