Quit it! — A quick tip for quitting a game in Unity

Almost everything you do in a video game has had to be added in by a programmer. There is no variable for speed, there is no function to pick up a powerup and there is no built-in function to quit out of a game.

If you have been following along on my articles we built our windows build here and you build and played your game, you would have noticed the only way to quit the game would be to use alt + f4 or tap the windows key and close the game from the taskbar.

What we need to build in is a control for the player to press which closes the application. Unity has an inbuilt method to call to actually close the program:

“Application.Quit();”

All we need to do is add this to our control scheme and call it when we press a button we decide on.

Unity developer with a love of learning all things programming.