5.4b18 ...Scene Hierachy

This error always happens when the game is playing in the editor, and the Scene Hierarchy has a bunch of gameobjects being created/removed and its causing the scrollbar to move around, sometimes when selecting any item in the list… it often generates this error…

Exception: NullReferenceException: Object reference not set to an instance of an object
UnityEditor.TreeView.GetNewSelection (UnityEditor.TreeViewItem clickedItem, Boolean keepMultiSelection, Boolean useShiftAsActionKey) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeView.cs:1000)
UnityEditor.TreeView.SelectionClick (UnityEditor.TreeViewItem itemClicked, Boolean keepMultiSelection) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeView.cs:1028)
UnityEditor.TreeView.HandleUnusedMouseEventsForNode (Rect rect, UnityEditor.TreeViewItem item, Boolean firstItem) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeView.cs:352)
UnityEditor.TreeView.DoItemGUI (UnityEditor.TreeViewItem item, Int32 row, Single rowWidth, Boolean hasFocus) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeView.cs:444)
UnityEditor.TreeView.IterateVisibleItems (Int32 firstRow, Int32 numVisibleRows, Single rowWidth, Boolean hasFocus) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeView.cs:568)
UnityEditor.TreeView.OnGUI (Rect rect, Int32 keyboardControlID) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeView.cs:504)
UnityEditor.SceneHierarchyWindow.DoTreeView (Single searchPathHeight) (at C:/buildslave/unity/build/Editor/Mono/SceneHierarchyWindow.cs:585)
UnityEditor.SceneHierarchyWindow.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneHierarchyWindow.cs:399)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

The temp solution seems to be just parent everything and hides its ass so its not expanded and any objects being (re)moved/created inside of it is hidden, then you don’t get anything causing the hierarchy views scrollbar to be moving about expanding etc …when you’re selecting anything in it… its still annoying and sometimes clicking on something doesn’t select it first time.

Also I’m tired of having only one effing Inspector view, should be able to have multiple gameobject views opened up. On the subject this

Should be built into the gui, so I’m not left dealing with useless workflow we have right now… instead 5.4 broke it.

Why I am using 5.4, because 5.3 has even more problems.

Maybe you can try and call

#if UNITY_EDITOR
UnityEditor.SelectedObject.activeObject = null;
#endif

before you start the process of deleting and creating a bunch of objects. that might be an easy and temp. fix ?

Well I’m not selecting anything in the hierarchy that is being moved/deleted etc… that kind of stuff could be happening at the bottom of the hierarchy list view out of sight while the active view area of the scrollbar is at the top of the list, and you could be clicking something at the top of the list, that isn’t moving about and it could trigger that error. So I don’t think the temp fixing of that setting in a object pooling system is really fixing the heart of the problem… it lies in unity’s own code.

(I know, but the exception is related to the selected object.)