My 90 day journey becoming a Unity game developer: Day-41
Jul 28, 2021
Objective: Using the Escape key to close the game out.
We’re going to add a quick way to exit the game if we’re playing in full screen. Under the GameManager script in Update(), set a condition that if the user presses the Escape key, the game will be shut down immediately. We will shut the game application down using Application.Quit() which by the way won’t shut the application down if you’re in the Editor so make sure to try it out on an actual full screen build.
This was a quick add-on to the game giving the user a way to exit the game.