For today’s article, I’ll be going over how I used Interfaces when developing my shoot ’em up game in Unity.

Full Code Source:

The Game:

What are Interfaces?

An interface in C# serve as a data contract where all classes to fulfill when implementing. The I in front of Example isn’t required to…

For today’s short article, I’ll be going over how to allow the player to quit the game by pressing the ESCAPE key.

Note: this is super useful only when the Unity game is a standalone build and especially when on full screen mode.

How to do it

if(Input.GetKeyDown(KeyCode.Escape))
{
Application.Quit();
}

Application.Quit() function will not work when playing the game from the editor. To test out the functionality, you must build a standalone executable of the game.

What it looks like in action

Harvey Limbo

Software Engineer

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