Hello,
Unity has a very annoying bug that probably only happens on my machine…
Every time I change code and go back to the editor there is a high chance of the editor to freeze forever.
The only thing that I can do is to kill the process…
It happens when I press play as well. Its so annoying… I miss the times where I could just run the game, change code, run again without worrying with the task manager open.
I cant work like that, I end up pressing CTRL + S every time I change something in the scene… Because the editor might freeze soon.
Sometimes it happens after every compilation, sometimes it takes a few, and sometimes it can be fine for 5 minutes and than freeze.
I have sent a ticket and the support stopped answering after giving me something to check without any help…
They could not reproduce the bug… which is even more frustrating…
I have Unity pro and i’m actually starting to feel sorry for that.
Hey, I’ve encountered some interesting project-breaking bugs before, and they are tough to reproduce. Here are some steps I recommend.
Delete the Library and Temp folders, and then open your project and let them rebuild
Duplicate your project. Delete any script you think could cause the problem (or just all of them) and see if a new script compiles. If it does, restore the scripts and keep removing them until you find the culprit.
Delete all scenes and try to compile (I had an error where a single scene was causing problems).
Basically my advice is to duplicate the project and then…delete delete delete! Eventually it will be a 100% clean project, which obviously should not crash (I’m assuming if you make a new project it’s fine).
Which OS BTW? If it’s the linux editor, I’ve occasionally gotten odd window freezes, of which I fixed by moving the window around, then re-maximising it. (This bug only happens on GNOME systems though, and it’s probably my outdated graphics chipset that’s the culprit)
I glanced at the bug and it seems QA hasn’t been able to repro. Could you perhaps attach a hang dump of the process? Windows let’s you do that via the Task Manager or grab a more advanced tool like Process Explorer (also via Microsoft).
Hang on… I did get a window freeze once, and it was straight after I modified a script… Hmm…
If I run into it again, I’ll try offering more info, since I dismissed last time as one of my laptop’s typical one-off moments…
Same thing is happening for me, on Windows 10, using latest patch release, on Android project. Seems to be ALWAYS happening when I press Play, then go back and modify a script in Visual Studio, save and then Editor freezes forever. I started removing some old scripts from my project, thinking it would help, but so far no luck. I’ll try to repro on a clean project for Android.
I have reimported project, disabled antivirus (Bitdefender), and it’s still happening. Just when it’s about finish compiling, it just freezes. Mono.exe is not running. And of course I’m unable to reproduce it on a new project, it’s only happening on the most important one
I FIXED IT!
Jesus, what a nasty thing that was. The cause was the Photon Cloud plugin, specifically the Chat. Not Unity’s fault. It seems you have to call Disconnect() on you Photon Chat behavior before you quit the game in the Editor, I’ve only begun to implement the Photon chat, just a barebones implementation attached to a gameobject, and it just left the connection open without cleaning itself up, and then on script recompile, it would freeze main thread for some reason. Seems someone at Photon forums had a similar issue few months ago: The Photon Forum is Closed Permanently. | Photon Engine
It seem to be happening only in the scene where I had the Chat thing object attached, so that’s how I was able to pinpoint the issue. Removing scripts one by one, pressing Play, modifying script and saving, then trying to compile.
I don’t know anything about Photon but it’s possible it has another thread running that is blocking Unity from proceeding. I’m working on a tool that uses networking and threads, and while I have my tool open with these threads running, if I trigger a recompile/reload assemblies or try to quit Unity, Unity just blocks until I kill the network connection (which causes the threads to finish). I think I dug into the Mono source code a while ago and found that it should be aborting any running .NET threads (but I wasn’t looking through the Unity version Mono I think).