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.

Escape key pressed to quit the game.

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.

Application.Quit() used when the Escape key is pressed down.

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.

Build the game through the Build Settings.

If you want to start the game from the file’s location, double-click on the name of the game’s .exe extension filename.

Game started from the file’s location.

With game active, start a new game …

then press the ESC key to quit the game.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store