Unity 4.1 - Game.exe has stopped working after Application.Quit()

After upgrading to unity 4.1 my game crashes with the error message ‘Game.exe has stopped working’ after I quit the game with Application.Quit(). The error doesn’t appear when I close the game by pressing on the ‘x’ button (in windowed mode) or by alt+f4. on mac it also works fine.

anyone else experiencing this issue?

Please submit a bug report with an attached project and build then send me the 6-digit case id and I’ll have a look for you.

Thanks,
Chris

Same issue here

The same issue, windows 64 build - crash on Application.Quit()

Hi guys,

Don’t just reply with “same issue” - Please one of you submit a bug report, details in my previous post above.

Thanks,
Chris

I have a 7 gb project folder, but managed to duplicate the bug in a test project by extracting my menu and intro scene into a new project.
Submited the bug as case 533156

Same Issue here… How can I view these bug report or the solution for that problem ?

Not sure if you can, you can only follow cases you submitted?
I think the solotion is waiting for a Unity update if this is a bug.

So it depends how important they rate this,
I have gfx issues that I rather see fixed then a end game error that are in queue since 3.5 and 4.0 …
Just to say this can take a while.

If the fault is on our end I will share any solution they come up with.

I had a responce today that says this was fixed in 4.1.
But for me this issue started with 4.1

Edit

Ok there is a 4.1.2 out now and the fix will be in this or a next release.

Same issue on an almost empty project standalone. Close the window, or invoking by code Application.Quit() the program crashes. O__o
Unity pro 4.1.2f here

You could still do it with System.Diagnostic.Process.GetCurrenProcess().Kill() but

Be carefull with this hack will work ith the Editor, which means, that it will force Unity shutdown at once(save your stuff!)

Hi,

I have same trouble, all was ok before i try 4.1.2 and now 4.1.3 :frowning:

I have bought unity pro and can’t afford to deliver commercial product that hangs … :frowning:

hopefully, it crashes after playing. it crashes with alt_f4 (it crash when quit). All is ok under Editor :face_with_spiral_eyes:

Would next release be Named “Blank Screen” ? I didn’t have seen a blue screen on Windows Os for a long longtime now, Unity wants to remind me such trouble ?

Hope you will find solution quickly. :smile:

I’m getting this also. There is a workaround. Instead of “Application.Quit();” use “System.Diagnostics.Process.GetCurrentProcess().Kill();”. But be warned if you use this in the editor it’ll kill you’re Unity Process, so make sure to save your work before clicking any Exit button from the Editor. It’s better to encapsulate it all into an if statement. “if (Application.isWebPlayer == false Application.isEditor == false)”.

UT, is there any update on this?? Please!

I have been updating through each version and it’s still there in 4.1.5.

I am told it will be fixed in 4.2

I’ve got this issue as well in Unity Basic. I also just started using Unity last week so its a brand new project and everything. However, unlike the original poster, I get the crash error after closing my app not only with Application.Quit but also Alt+F4 and clicking the X. Occurs on Windows 7 building both x86 or x86_64.

Wow… what a lovely bug. I’ve waited many moon to finally make the hop from Unity3.5 to Unity 4 (bought Unity 4 last year before it was released), hoping fundamental engine issues would be fixed. Now I need to get out my tee-shirt that says, “I upgraded Unity and all I got was another fundamental engine bug” :). I jest, but if this has really been present through most of the 4.1 builds, I’m perplexed by how this can be allowed to persist so long.

Anyway, the workaround isn’t as clean in my case. I intercept application close and do a save game. My game can be closed by the window close button (when in a window), but a keyboard shortcut, or by a menu button. It the last two cases, I call Application.Quit().

So to work around this, I still call Application.Quit(). I have a ‘void OnApplicationQuit() {}’ function in my main game class. Inside that, I auto save, call Application.CancelQuit(), then call System.Diagnostics.Process.GetCurrentProcess().Kill().

Actually, it’s more complex than that since I have a popup dialog to confirm the exit, there are different parts to the game where you can exit (within a mission, within ‘space’, within the main menu… and all have different exit handlers. But in general, the workaround seems to be:

1: Still call Application.Quit() (this is so I can intercept the application exit. If I didn’t care about this, I’d just make the process Kill call).

2: Implement OnApplicationQuit and within it call Application.CancelQuit(), then System.Diagnostics.Process.GetCurrentProcess().Kill().

I have the same bug, but nearly found out what it causes:

It´s the amount of trees on terrain.
As soon as I delete the trees the errormessage doesn´t appear anymore after quit.

This happens to me, may be it´s something else…

u serious about the trees beeing the reason for this application quit error thingy here?

Yes, at least for one project where I intensively figuered out the reason by deactivating scripts and objects step by step.
As soon as I deactivate trees or no trees have been rendered in runtime, the error message does not appear.

But maybe on other projects, other things cause this error.

You can try and simply deactivate trees to see if it also fits to your project.

No. I don’t have any “trees” or anything like that in my project. In my case (and I suspect most others) it seems to have to do with how much cleanup has to occur during shutdown. That’s a guess, though, since it seems to happen more frequently based on how much geometry/objects/etc. got created by a scene. It’s an inconsistent but frequent occurrence in my game. It also happens sometimes even when pressing the window close button (not just when calling Application.Quit). So I have to implement OnApplicationQuit and call Kill instead.

Interestingly, the game exits a whole lot faster by calling Kill. So this workaround makes me nervous. I also wonder how it is even possible for anyone to be shipping anything at all with Unity 4? There is no way I would ship a game, that has a large customer base, that crashes with this frequency on exit. So either everyone is implementing this workaround or no one is shipping with Unity 4. If everyone is implementing this workaround, then it is perplexing that this tiny little topic on this high volume support board is the only mention I’ve found of this issue.