- Home /
Linux build freezes on application.quit
Working on porting a game to linux, and everything is working great in my build, except when quitting the game, sometimes it just freezes and I have to kill the process from the linux process manager, sometimes it works as intended. I'm using Unity 5.4.0b17. In windows builds quit works consistently.
The code I use is a simple c# call:
Application.Quit();
There is no other cleanup/operations manually scripted on quit.
The term "sometimes" is usually an indication for race conditions. So two questions:
Are you sure you call "Application.Quit();" from the main thread?
Do you use any other threads? If so do you ter$$anonymous$$ate those threads?
How would I know if I'm calling it from the main thread? Its actually called in an onGUI update (as I'm using the older onGUI buttons/menu systems), is this a problem? Would moving it to a void, adding a bool so it triggers once, and then invoking that void makes things better?
As far as using other threads, I may have IEnumerators running, do I need to stop all co-routines? Can I do this globally, or do I need to do it from each script they may be running in if necessary?
Your answer
![](https://koobas.hobune.stream/wayback/20220612084146im_/https://answers.unity.com/themes/thub/images/avi.jpg)