Application.Quit() is taking a long time to exit the game

Having an issue where Application.Quit() is taking a long time to exit the game from a built version of the game. I have seen this issue in a few Google searches and I attempted changes that I found without any luck.

Things I have done:

  1. I am using StopAllCoroutines() on scripts that are running coroutines in the OnDisable methods so stop routines when scenes are being unloaded
  2. I used Memory Profiler to check for leaks, but it looks like after my game runs for a bit sometimes it will actually be using less memory than when it started.
  3. I loaded up an empty scene in a build that just checks for a key press to quit the game, and directly calls Application.Quit(). I get the same result when doing this. This one makes me think some asset or plugin is doing something that I don’t understand.
  4. I grabbed a Player.log which I will upload here. I probably need more experience reading these. I see many ALLOC_TEMP_Job.Worker lines even though in my generic test scene I am not using any of this. Can this be a problem and if so, is this some Project setting that I need to change?

Player.zip (2.8 KB)

Thanks for any help!

Edit: Oh, more important info, I made a dev build and attached to it and then ran Application.Quit(). I paused the execution on the debugger but I my call stack never seems to actually land on any of my own code. It looks like there’s a thread running but I can’t view the code for it:

Interesting. And what happens if you create a new empty project with that scene?

If this would also prevent Quit from working quickly, it might indicate that the issue is with the system, like a driver version or security software.

Logging a lot when exiting could also delay Quit for sure.
These temp job warnings occur in the editor too and may be due to bugs of Unity code, or improper or heavy use of some feature or API.
Be sure to run the latest patch level of 2022.3. It’s on 55f1 I believe.