Corrupt project making Unity freeze. Now Unity won't open at all.

So, this is a two part question I suppose. Just looking for any helpful feedback.

  1. Something happened in my Unity project to freeze up. It seems to be a particular file, or combination of files. One night it worked. Then the next day I opened it up and it hung indefinitely, using a decent amount of the CPU.

I am on Windows 7 running Unity 3.5.5. So I set about to create a new project and copy pieces over a few at a time. Somewhere along that process Unity began to freeze up again. It looks like it’s a .js script file. That’s weird though, it seems I would just get an error in the debug log.

So, I uninstalled and reinstalled Unity, and now part 2…

  1. Unity will not run at all. I have restarted my computer, reinstalled Unity, excluded DEP in Windows settings. I even did a system restore to when Unity worked just a couple days ago. Nothing.

So I have taken two steps backwards and I’m completely stuck. On top of that, the game I was building is supposed to be done now, and I can’t even work on it. =(

I’ve solved the corruption issue and wanted to warn anyone else of this problem. I found out I had an endless inheritance loop in my scripts: ClassA extends ClassB, and ClassB extends ClassA. Not cool, I know. Silly mistake, but it shouldn’t break Unity in my opinion.

I now realize that Unity begins compiling project scripts upon starting up and it was in the loop that Unity got caught up. It used nearly all my CPU infinitely until I would hard quit the program. This seems like a bug to me. Many other editors have a timeout feature built in. If a single script executes for say 15 seconds (or however long you specify) it will break and give you a warning. That’s logical. Freezing the program to me is not logical.

A helpful suggestion I have if Unity is freezing on you at start up is to check the editor log file. On Windows 7 it is located at:

C:\Users\[user]\AppData\Local\Unity\Editor 

My log file had 30Mb of the following printouts:

GUIManager:.ctor() (at Assets\Scripts\Managers\GUIManager.js:16)
FullscreenGUI:.ctor() (at Assets\Scripts\GUI\FullscreenGUI.js:1)
GUIManager:.ctor() (at Assets\Scripts\Managers\GUIManager.js:16)
FullscreenGUI:.ctor() (at Assets\Scripts\GUI\FullscreenGUI.js:1)
GUIManager:.ctor() (at Assets\Scripts\Managers\GUIManager.js:16)
FullscreenGUI:.ctor() (at Assets\Scripts\GUI\FullscreenGUI.js:1)
GUIManager:.ctor() (at Assets\Scripts\Managers\GUIManager.js:16)
FullscreenGUI:.ctor() (at Assets\Scripts\GUI\FullscreenGUI.js:1)
GUIManager:.ctor() (at Assets\Scripts\Managers\GUIManager.js:16)
FullscreenGUI:.ctor() (at Assets\Scripts\GUI\FullscreenGUI.js:1)

This would have been helpful for me to solve my freezing start up issue.

Some suggestions:

  • Remove all “ExecuteInEditMode” attributes.
  • Make sure you don’t do anything that can “hang” in Start, Awake or the constructor of any of your classes.

That are just general suggestions since without a piece of code we can’t say what you’re doing in your scripts. Maybe you launch a nuclear missile somewhere in russia :smiley:

Have you tried holding “Alt” while opening Unity? That will generally bring up a window where you can choose which project to open. Choose a different project. If this works, and the new project opens, then Unity isn’t corrupt, and it’s just your project. (Small consolation, maybe, but at least you’ll know whether or not Unity itself is broken.)

I dont know if this helps but I just was about to pull my hair out it crashed so I restarted my computer , so I was copying the project so I could try to edit the scripts to see if this was the error while I was copying though some how unity had renamed a folder with a bunch of character’s so unity could not open this “folder” and would just crash… look to see if there are any irregular folder name’s… and if so just shorten the folder name by renaming it.

Bump

Unity hangs on certain project and says “compiling scripts”

Reinstalled. Good until I encountered an inability to Play the current Scene, claiming: “Cleaning up leaked objects in scene since no game object, component or manager is referencing them
Texture2D has been leaked 1 times.” Unity crashes after Save Scene/Project/Quit. Now (all) projects refuse to open. Hangs on “compiling scripts.”

As per certain suggestions here, removed any occurrences of “ExecuteInEditMode” that were not part of Standard Assets (in a simple 3rd-party asset).

@GWJustin: Thank you for this thread. It pointed me in the right direction and got me thinking about scripts that could be causing problems on project load. And sure enough, there was a script that was complaining about a reference to a value that was null and it could not be validated on Awake() so the CPU munched on that forever. Now, after validating that function call the script does not throw a warning and now the project loads quickly again!

Note to everyone and reminder - always test each step of the way instead of getting too far along and attempting to debug the many things you’ve done since the last revision. Learn from my fail haha.

Loaded up the game Log that was recommended by GWJustin and found this in the logs

Load scene ‘Assets/Scenes/Game.unity’ time: 0.011588 ms
The file ‘E:/…/Assets/Scenes/Game.unity’ - ‘Assets/Scenes/Game.unity’ is corrupted! Remove it and launch unity again!
[Position out of bounds!]

Removed the scene and can now able to open the project