“Funslingers” Devblog #24 | The Exit Button
Since we’ve finally created our first build of our game, it’s time we create the essential function that is our Exit button.
With just one line of code, we are able to give the player the option to stop playing our game, even if it’s an option they wouldn’t DARE to choose!
So where will the player be able to quit the game? In the Main Menu as well as our Game Over screen, we have an Exit button!
So, easy enough, we can just create an Exit Game Method for these buttons to call.
It’s in a coroutine to simply create a 1 second buffer, both for the button animation to play, as well for the game to not close too abruptly.
And that really is it! When our Exit button is pressed, it will call Application.Quit() and the game window will close successfully.
It was a very short devblog today, but don’t worry! Next devblog will be very exciting as we are gonna get back into adding new things to our game, and we’re gonna start with a brand new ability for our player!