The Escape Button is a Feature

--

Objective: Implement quitting the game by pressing the escape key.

At this point in the space shooter 2D tutorial, the windows build does not have a way to conveniently quit the game. The player will have to end the task of the executable. To quit the game with by pressing the escape key, we will edit the GameManager.cs script.

In the Update() method, add this conditional and quit statement:

if(Input.GetKeyDown(KeyCode.Escape))
{
Application.Quit();
}

Now, when you compile the game for windows, and run the executable, the escape key can be used to quit the game even in full screen mode.

--

--