Unity Developer — Quitting Time

Christopher Graf
1 min readJun 18, 2021

--

When talking about making builds of your game, I suggested making your games in a windowed format, rather than fullscreen. Part of this is because we had no way of exiting the game in that mode. Well, now we do.

There is a simple function that allows us to quit our built project that is easy to integrate if we so choose. If you have a Game Manager object and script, I would suggest placing it there. Go into Update() and make an IF-statement for player input. It is most likely best to use KeyCode.Escape or KeyCode.Q, but you can choose whatever you like.

Within the IF-Statement use Application.Quit(). That is it! Like I said, very simple. Because it is so simple, however, you may want to add some UI for this. Maybe have the Escape key or Q pause the game and pop up a menu saying “Are you sure you want to Quit?”

We wouldn’t want any players losing their high score because they accidently quit the game.

--

--

No responses yet