unity crashes on exit

This seems to happen at random, and I’ve had it on both of my machines and the machines at my uni, so I’m pretty sure it’s not a problem with the machine (though I could be wrong).

Basically what happens is, when I exit unity, by clicking the x in the top corner or alt-f4, the editor just hangs indefinitely and task manager instantly reports it as not responding.

This has happened on windows xp, 7, 8 and 8.1, with unity 4.3 and every update since.

Anybody know of what could be causing this and/or possible fixes, it would be greatly appreciated.

same thing happens to me since i updated to 4.3, i don't think it's our fault, i'm just waiting for another update

–

4 Answers

4

kill the adb.exe process and then close UNITY.

it's adb.exe *32 if you have 64bit system... if you already closed unity and it hanged. just close the process and unity will be closed as well.

–

so wait, it's an android thing that causes it?

–

kind of... and it's not a solution. only a work around. i think unity guys still need to work it out.

–

thanks for the work around, would be nice if there was a proper fix though

–

[This answer solved it for me][1] if I launch Unity from a batch file that first loads adb! Also, [this Issue Tracker status][2] is closed. Do we need to re-file the issue? [1]: http://answers.unity3d.com/questions/582789/unity-freezes-on-quit-43.html [2]: http://issuetracker.unity3d.com/issues/adb-locks-unity-editor-and-the-editor-starts-to-hang-when-trying-to-close-it?page=3#comments

–

As of 4.3.4f1 it still exists as a bug. Need to run taskkill /IM adb.exe /F
Seems to be a questions of the “WRONG” version of ADB.EXE from what I have read, but which is the “RIGHT” one?
This powershell script fixes it:

start-process "D:\Program Files (x86)\Unity\Editor\Unity.exe"

$unity = get-process unity

$adb = $NULL

do {

 $adb = get-process adb

 if($adb)
 {

     Stop-Process $adb.id

 }

  Start-Sleep -m 5000

  $unity = get-process Unity

} while( $unity -ne $NULL )

HOW TO RUN IT: Create a shortcut with this in it

powershell.exe -windowstyle hidden -File "D:\Program Files (x86)\Unity\unity.ps1"

Files here: FILES

(windows) open notepad, and paste this

(“Name” = your account name)

(Program Files (x86) can also be Program Files, depends on your hardware)

.

@echo off

cd C:\Users\“Name”\AppData\Local\Android\android-sdk\platform-tools

adb devices

cd C:\Program Files (x86)\Unity\Editor

start Unity.exe

Exit

I had a very similar problem which was resolved just by adding the location of ABD as a system path.
Tried the above script and realised that ADB wasn’t even running.

Once I added the location of ADB as a system path, I’m guessing Unity could then find and start/stop it itself so the crash on exit was resolved for me. I didn’t need to use the above script after that.

To add ADB to your system path:

  1. Open command prompt as admin
  2. Type: setx PATH “%PATH%;C:\Program Files\android-sdk-windows\platform-tools” (change location of ADB as required)

The above fixed the crash problem for me on Windows 8.1 and I also force DX11 to make Unity more stable on Windows 8.1.

I’m also not sure if Unity installs the Android dev tools because I already had those installed so if you can’t find ADB and have the same problem I would suggest installing the Android dev tools as per the below article then setting the system path to ADB.