x


Can I open EditorWindow from CustomInspector ?

When I try to open EditorWindow from CustomInspector, I have such errors :

NullReferenceException: Object reference not set to an instance of an object UnityEngine.GUIUtility.GetControlID (Int32 hint, FocusType focus) (at E:/BuildAgent/work/68355d6e5d19d587/Runtime/Export/Generated/GUIUtility.cs:250) UnityEditor.InspectorWindow.OnGUI () (at E:/BuildAgent/work/68355d6e5d19d587/Editor/Mono/Inspector/InspectorWindow.cs:231) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)

Something wrong with GUILayout. The window opens, but I allways see this error. How can do it without abuse in the console?

more ▼

asked Sep 15 '10 at 07:24 AM

neodrop gravatar image

neodrop
116 1 3 9

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Not sure what is happening here, but one thing you can try is to call the undocumented function GUIUtility.ExitGUI(), right after opening the window. Possibly, the opening of the window upsets the state of the GUI layout system, so you'd just exit the GUI from there, and have it all fixed in the next layout event.

more ▼

answered Sep 15 '10 at 12:04 PM

jonas echterhoff gravatar image

jonas echterhoff ♦♦
9.8k 7 23 104

O, Man! You make me happy! Thanks a lot!

Sep 17 '10 at 05:49 AM neodrop

Thanks! This solved the problem for me; Even though it isn't pretty.

Oct 19 '10 at 02:11 PM YetAnotherUnityQuack

Thanks a lot! For me this error happens on OS X only, but your solution/workaround solved it.

Jan 07 '12 at 08:21 AM Jake L.
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x175

asked: Sep 15 '10 at 07:24 AM

Seen: 1341 times

Last Updated: Jan 07 '12 at 08:21 AM