The Escape Key is a Feature

Rook Sullivan
Jun 22, 2021

Although it seems like something you see in every game, there is no way to quit a Unity program running in full screen by default. To fix this, I have added a function that allows a user to exit the application when pressing the Escape key.

This is done by adding a simple If statement to the GameManager script that checks for the Escape key to be pressed. When it detects the Escape key, it runs Application.Quit(), which closes the game. A more robust implementation would instead open up a menu or a confirmation box when Escape is pressed, and allow the user to quit from there.

--

--

Rook Sullivan

Non-binary game dev sharing my experiences in Unity.