The Escape Button is a Feature
Jun 1, 2021
Unity doesn’t have the a way to exit the game by default once you build it. When it’s played in windowed mode you can hit the close window button with the mouse. The problem is when you go full screen there is no button to exit the game. We need to build this functionality in manually.
Add the following code the detect the Escape key getting pressed to exit the game.
if (Input.GetKeyDown(KeyCode.Escape))
{
Application.Quit();
}
This can’t be used in the Editor. You will need to build to use this.