Unity crashes when loading scenes in Editor but not when built

Hello, I am currently developing a game for the Vive using Steam VR. After updating to 5.5, Unity is freezing when I try to load into roughly half of my scenes when playing in the editor (I have not made any changes), but when I build and run, Unity does not freeze and everything works as would be expected.

I have gone as far as removing all game objects from a scene and replacing the vive camera rig with a unity camera and clearing all baked data, and even then, when I load into the empty scene the Unity editor will still freeze. This is very strange because I can load into some of my other scenes without them being affected.

One thing that I have noted is that the affected scenes that I can not load into I have heavily been working on in 5.5 and not so much in 5.4, so perhaps there is something there?

All of the scenes use the same prefab for a character controller, and the only scripts in my scenes are attached to that. I am really at a loss here. Any ideas or thoughts about things I can try to resolve this would be much appreciated!

As I stated previously, the game builds and runs completely fine, but the editor in play mode freezes when loading into some of my old scenes, even after removing everything from them and only leaving in a Unity camera object to sum it up.

Thanks in advanced for any help that anyone may be able to offer!

I just tried deleting my Library folder and reloading the program. It took a while to reload, as was to be expected, but once finished the problem still persists.

Are you currently debugging when loading into scenes? For example, you have debug mode started in MonoDevelop when loading into a scene? What does Unity.log say?

It is just showing normal script execution, and the client freezes. The execution stops at different points, some times I can load into a scene for a second or two, sometimes its instant, some times it is 30 seconds in.

So, I have a menu scene, from this scene I can load into scene B and not have any issues, however, if I load from the same menu scene into, lets say, Scene A, scene A, every time, even when there is nothing in the scene except for a camera freezes.

It is really bizzarre. If I build the game, I can load into Scene A as normal and no problem.

Something else I just found out, I started disabling objects in the effected scenes to see if maybe a material or something was causing the bug. A unity plane object I was using as a floor, if I disabled it, would allow me to load into the scene. It is just a plane with a unity black texture on it.

I then rebaked the scene to see if it was a lighting issue, after rebaking, disabling this object no longer allows me to load in. Any thoughts?

I’ve been having a similar issue for about a year now. The editor will freeze up completely on loading/unloading scenes. It will happen for many different scenes in my project. Running in build is fine, just the edtior freezes. To me it looks like scenes with more GameObjects cause the freezes.

Hi guys.

Maybe a bit late but I’ve been fighting with this for a while and I think I’ve a solution.

My problem was that UNet uses internally AsyncLoad to change scenes across network, and that was producing a freeze only on the editor. This breaks all the testing workflow.

As far as I know this problem is directly related to the steamvr SDK. If you set the Virtual Reality sdks to None it will work.

The solution for me was adding this in some behaviour in the first load:

void Awake(){
   Application.backgroundLoadingPriority = ThreadPriority.Low;
}

I found that snippet just before the scene load part in SteamVR_LoadLevel.cs

I hope it helps :smile:

False alarm.

After more testing the editor has started freezing again. Now, I can’t verify if this improves the situation. Seems that changes in the scenes still affects to the loading and freeze the editor. :frowning:

For now, this seems to be working:

Since updating to 2017.3, one scene in my project cannot be loaded. If I open it, it crashes the Editor. I wiped the Library metadata folder and it managed to open once, but never again. As others have stated, I have no issue exporting a build. It’s only when opening the scene in the Editor.

1 Like

Did you find a solution for that? I have exactly the same problem

@blackfox_studio …and did you find a solution… I have the same issue in 2019.2.7f2. on mac BigSur. I have other projects on same version of unity that work fine. just one project immediately crashes upon hitting the play button in any scene, even a new empty scene in one project. Reinstall unity, re-pull repo, delete library folder, switch platforms… nothing works. any ideas ?

Update… in case it helps anyone else…
If I disable editor setting, for atlasing from always to ‘build only’. unity no longer crashes pressing the play button in any scene.