I take an empty gameobject and a script in which I just write below code to handle back button in android phone, but it's not working.
if (Input.GetKeyDown (KeyCode.Escape)){
// Escape button pressed
print("Escape");
}
if (Input.GetKeyDown (KeyCode.Escape)){
// Escape button pressed print("Escape");
}
This code is working. Problem was i was testing it through unity remote 5. that's why it was taking input from keyboard not from mobile, When i tested it by making apk its working.
OnApplicationPause(){print("Escape");}
and let me know how it goes. Also, @Stephan InputManager doesn't have the Escape as a key, it's a built-in keycode (at least it is so in the latest version). \$\endgroup\$