[Solved] Cannot exit when building for PC

Hi there,

I have a problem. I built the game for PC instead of Web; However, I cannot exit it when running on fullscreen.

Am I missing an option in the setting menu?

Thanks

Hi @Sergio.asr16,

Add the following to your Update() method, or, a method which checks for player input from the Update() method.

private void Update()
{
    // check for escape key
    if(Input.GetKeyDown(KeyCode.Escape)
    {
        // quit the application
        Application.Quit();
    }
}

See also;

Unity Scripting API : Application.Quit
Unity Scripting API : Input.GetKeyDown
Unity Scripting API : KeyCode

It works!! Thank you :slight_smile:

1 Like

You’re welcome :slight_smile:

Privacy & Terms