how to my game press esc and quit that very simple give me a script and tutorial
function Update ()
{
if(Input.GetKeyDown(KeyCode.Escape) == true)
{
Application.Quit();
}
}
Link to Application documentation
Good luck!
Here’s a c# version of a Quit button.
void OnGUI(){
if(GUI.Button(new Rect((Screen.width) /2, (Screen.height)/2, 50, 50), "Quit Game")){
Appliation.Quit();
}
}
This is the verson where you press escape to make it quit.
void Update() {
if(Input.Getkeydown("Escape Key"){
Application.Quit;
}
}
For more variations check the unity scripting refrence.