Feature Highlight: The Escape Button as a Feature

Chase Mitchell
2 min readMay 3, 2021

While we would all love users to play our games forever, at some point they will need to quit the application. It is very important to add an “Escape” or quit function to your game to make this process intuitive and prevent some less tech-savvy users from getting stuck in your game. Let’s look at a quick way to set this up.

Generally your game will have some sort of GameManager script which controls things like loading scenes. This is a perfect place for a quit function.

First you need to check for user input in the Update() method, and here we’re looking for the Esc key. If the key is pressed, you could either pause the game (set time scale to 0) and load a menu overlay (set it Active) with a number of options, or you could keep it simple and quit the game right there. For our game we’ll go ahead and just quit the application:

Simple as that! It’s an easy quality of life feature you should implement to make your game experience as smooth as possible.

--

--