How to make a quit button [C#]

hey guys, i just got one problem while making my new game and that is the quit button right now i am using 3D Text and i have try void OnMouseDown(){Application.Quit;} But it does not work, i dont want that thing where you need to press a key to quit i just want it where the player can click the exit button and exit the game. Thanks

Whatever object you use with function OnMouseDown() must have a collider component or be a GUIElement. Check the docs here. And Application.Quit(); needs the parenthesis.

Try:

if(GUI.Button(new Rect((Screen.width)/2-50, (Screen.height)/2-100, 100, 50), "Quit"))
{			     
	Application.Quit();
}

This will create a quit button, however it won’t do anything in the editor, you will have to create a build to test it