Quit Game in Unity

Rusben Guzman
Jan 8, 2022

--

Objective: write a function to quit the game.

In the UIManager I created a new public function called Quit. Unity provides a function called Application.Quit() and that’s that you need to do. But if you are playing in the unity editor it is not going to work. You can use this alternative UnityEditor.EditorApplication.isPlaying = false.

During development you can use the second alternative and just comment the other and change it when you build the game.

--

--

Rusben Guzman
Rusben Guzman

Written by Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

No responses yet