exit app doesnt work

hey guys this little script doesnt work it doesnt close the app when i press escape in my game i know it doesnt work in the editor but i have made a build version so i think it hasto work but it wont

do you now whats wrong? function Update() {

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

i have attached the scrip on a empty game object in the sene but still nothing

Hello Wesley,

Please try this. I've tried works.

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

Regards

It works, thanks.

I put it to the main camera object. Wonder if it’s the right place.