NullReferenceException involving loading windows?!
This error:
NullReferenceException: Object reference not set to an instance of an object UnityEngine.GUI.Toolbar (Rect position, Int32 selected, UnityEngine.GUIContent[] contents, UnityEngine.GUIStyle style) (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUI.cs:959) ProBuilder2.EditorCommon.pb_Editor.DrawHandleGUI (UnityEditor.SceneView sceneView) ProBuilder2.EditorCommon.pb_Editor.OnSceneGUI (UnityEditor.SceneView scnView) UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2075) UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1405) UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1242) 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) This makes all my scene windows seem to glitch out, that includes the Game window, animation window, and seemingly every other window I try to load. And I don't know how to fix it. I had this problem once before on a different project, but it didn't upset me much because the project was easy to replace. But now, this happened on a project that I need to finish. And it's too big to redo completely. Is there any way to fix this?
Quick edit: I found out that if I put the windows on a different part of the screen, they work. But how do I get rid of the old part of the screen? https://i.gyazo.com/5acf7ec3da332296294419be0dc81b33.jpg
Answer by Zealot35 · Jun 24, 2018 at 04:56 AM
Hey me from 25 minutes ago, I found your solution that literally only took some digging around for! Who knew there were millions of other people on the internet that have your EXACT same problem! Anyways, the error that popped up? click on that until it sends you to another tab in where the Inspector should be! Then go into Debug mode and set the size of all the windows (you know, the amount) to 0. Then, set the "current window" string to 0 as well. After that, right-click on your Console window and go to "add window" and add the Game Window. Make sure any errors are cleaned up (the one that pops up for this situation should be gotten rid of by clicking "clear") and click play! After it loads, go ahead and click stop. After that, you will be free to add the Scene Window back into your screen view! Then, after after AFTER all of that, you can right-click on the original screen view and add your tabs back in. Presto! Literally only took about 25 minutes! Hooray!
I should add that this happens if you happen to have a lower version of Unity. I believe this happened to me because I started this project in Unity Version 5.5.0, and now the latest version is 2018.3.
Answer by Rebaken-Enterprises · Apr 01 at 02:20 AM
I had this issue, and found this answer ... so instead I quit and restarted Unity and that fixed it. :D