- Home /
How to make Application.Quit() Quit immediatley/faster?
As part of the punchline in a little project I'm making, I want the game to close to desktop instantly. I was able to get it to quit very quickly in a project that only had like 3 objects and 1 script, but in this project, when Application.Quit() is called, it freezes for about 2-3 seconds and then closes, which I expect is normal, and perfectly fine any other time.
So my question is, can I do anything in the background before Application.Quit() is called to make it quit faster?
I've already tried destroying every object that isn't currently being used in the scene right before it closes, but that doesn't seem to make much of a difference. Thanks!
Answer by Zaeran · Mar 14, 2021 at 03:48 PM
When you call Application.Quit(), it destroys and dereferences every object in the scene. If you have a lot of objects, this can be a lengthy process. Destroying every object beforehand will cause a hang as well, since that's where the hang you're experiencing is coming from.
You may be able to pull some shenanigans by finding the (System.Diagnostics.)Process that represents your game and call the Process.Close() command to close it instantly, as if it were being closed from the Task Manager.
Your answer
![](https://koobas.hobune.stream/wayback/20220613030548im_/https://answers.unity.com/themes/thub/images/avi.jpg)