Search Unity

Unity crashes when loading scenes in Editor but not when built

Discussion in 'Editor & General Support' started by ScottRichards, Dec 27, 2016.

  1. ScottRichards

    ScottRichards

    Joined:
    Oct 20, 2016
    Posts:
    23
    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!
     
  2. ScottRichards

    ScottRichards

    Joined:
    Oct 20, 2016
    Posts:
    23
    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.
     
  3. tsibiski

    tsibiski

    Joined:
    Jul 11, 2016
    Posts:
    273
    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?
     
  4. ScottRichards

    ScottRichards

    Joined:
    Oct 20, 2016
    Posts:
    23
    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.
     
  5. ScottRichards

    ScottRichards

    Joined:
    Oct 20, 2016
    Posts:
    23
    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?
     
  6. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    266
    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.
     
  7. Nesvi

    Nesvi

    Joined:
    Jan 26, 2013
    Posts:
    10
    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:
    Code (CSharp):
    1. void Awake(){
    2.    Application.backgroundLoadingPriority = ThreadPriority.Low;
    3. }
    I found that snippet just before the scene load part in SteamVR_LoadLevel.cs

    I hope it helps :D
     
  8. Nesvi

    Nesvi

    Joined:
    Jan 26, 2013
    Posts:
    10
    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. :(
     
  9. Nesvi

    Nesvi

    Joined:
    Jan 26, 2013
    Posts:
    10
  10. TheSwain

    TheSwain

    Joined:
    Jul 2, 2014
    Posts:
    4
    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.