44-Quit Application with the Escape Key

While it may seem intuitive to press the Escape key to quit the game, this function does not come naturally, it needs to be coded by the game developer.

Take this game, for example, we can add a few lines in our GameManager script and tell the application to quit once receiving the user’s input of the escape key, that is:

Voila, now when the game opens in full window mode, we will be able to quit the game by following our old habit, pressing the Escape key.

However, it should be noted that this function cannot be tested in the Unity Editor; it will only work when we actually build and run the game.




Progress of developing the classic galaxy shooting game using Unity and C#

Recommended from Medium

What are the Current Trends in Agile Development?

Posture tracking with OpenCV for gaming

Life is a journey of twists and turns, peaks and valleys, mountains to climb and oceans to explore.

Build an App Like Lego — Tutorial 14

Research on Case studies of fixed capacity Queue and Changing the Queue capacity using Artificial…

How to create a function in python to be used from the terminal

What is Freeswitch?

[Experimental] Compiling Scala into Closed Cartesian Categories language using ScalaFix rewriter

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


Technologist and Unity developer

More from Medium

Nexus, the Year in Review

Dynamic Base Asset Allocation for Portfolio Management

How to Save Electroencephalography AI

Assessing the quality of new PUE technologies: from egg incubators and beyond