- Home /
Application.Quit() not working
Hello,
I have added a little menu to my game, it has a button:
if (GUI.Button(new Rect(MenuSize.width - 95, MenuSize.y - 195, MenuSize.width - 10, 25), "Exit Game") == enabled)
Application.Quit();
Which does nothing when I click it.. Can anybody see what I'm doing wrong?
Thanks!
Answer by testure · Jun 11, 2011 at 09:22 PM
If you're doing this from the editor I'm pretty sure Application.Quit() doesn't do anything. Try building your project and clicking your button there instead.
Answer by alexfeature · Jun 11, 2011 at 09:10 PM
Remove the '== enabled' part.
GUI.Button evaluates to a bool value by default. There is no need to check if true is true...because it's false like half the time :)
Your answer
Follow this Question
Related Questions
Delay quitting and finish some coroutines 1 Answer
Unity will not open(Linux) 0 Answers
Android app not closing complete. 2 Answers
Application.quit() not working on android 5 Answers
Proper way for Quit Application 2 Answers