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

Luke Duckett
1 min readApr 26, 2021

--

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.

--

--

Luke Duckett
Luke Duckett

Written by Luke Duckett

🎮 First Nations Unity Dev from Wonnarua country 🏞️ | From Player to Lifelong Learner: Crafting Games, Debugging Code, and Embracing New Technology

No responses yet