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!

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.

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 :slight_smile: