I am trying to make the application quit itself when you press the back/return key of a Android phone.
I tried putting this code in the update of a script attached to a gameObject that is present in all my scenes, because of DontDestroyOnLoad
:
if (Input.GetKeyDown(KeyCode.Escape))
{
Application.Quit();
}
I just tested something to see if I get inside the if, when playing on my phone. And I get there. Application.Quit()
is the issue here. I hope someone can help me and explain how I can quit the app in Android.
Thanks! :)