How do i make a simple quit command?

i want to quit my game by pressing escape and not taskmanager.
i found this:
// Quits the player when the user hits escape function
Update () { if (Input.GetKey (“escape”))
{ Application.Quit(); } }

but it dosen’t work, help!

It works in build application
it does not work in editor

i did build it, but it still dosen’t work.

Update ()
{
   if (Input.GetKey(KeyCode.Escape))
   {
      Application.Quit();
   }
}

copy this

1 Like

okay i fixed it, i forgot to add it to the game… that makes feel stupid lol

1 Like

hahahahahha its true, stupid mistakes are most of the time, the reason. nothing to worry