Trying to get the application to quit when i have 3 coins collected and the player collides with a box collider.

End Game script;
107940-screenshot-5.png

107941-screenshot-6.png

Would appreciate any help, thankyou :slight_smile:

Two issues. First, quit is a method. You need to write it as Application.Quit(); with opening and closing parentheses.

Second, it won’t work the same way when you’re running it through the editor. This answer describes how to write code that will run based on whether you’re in the editor or not. Here it is reproduced:

     public void QuitGame()
     {
         // save any game data here
         #if UNITY_EDITOR
             // Application.Quit() does not work in the editor so
             // UnityEditor.EditorApplication.isPlaying need to be set to false to end the game
             UnityEditor.EditorApplication.isPlaying = false;
         #else
             Application.Quit();
         #endif
     }