We’re in the homestretch! For this article, we’re going to be fixing our game up since we currently do not have an exit option unless we want to force quit our game with Alt + F4.

What we’re basically gonna have to do is create a line of code so that the game recognizes that when we press our esc key (or any key you choose, but esc is generally accepted as the key to use in this situation), we want to leave our game.

Simply all we have to do is go into our Game Manager script and tell Unity that if esc is pushed, we want to quit the application:

--

--