My journey becoming a Unity game developer: How to Build and Test your Unity Game on PC & The Escape Button Feature
Objective: Implemented the ESCAPE key to be used to quit the game application during runtime. Also, building the game out for PC to test out the Quit() Application method.
Just in case we need to shut down the game when in full-screen build mode for any reason, we will quit the application using the ESC key. Inside the GameManager script under the Update() function, we will check IF the Escape key is pressed down. If so, use the Application class to access the Quit() method.
Now to build the game out we need to go to File->Build Settings. By default Windows, MAC, and Linux is selected for the game to be built to. Make sure Target Platform is selected to your OS Type which is Windows for me, and Architecture selection is Intel-64 bit if your computer is a 64-bit architecture. Click on Build if you want to build the game, then go to the file location where the game was saved. Or, select Build and Run to start the gameplay immediately after saving the game.
If you want to start the game from the file’s location, double-click on the name of the game’s .exe extension filename.
With game active, start a new game …
then press the ESC key to quit the game.