Quit Game in Unity
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.