- Home /
Can a GameObject's full inspector be drawn in a custom Editor Window ?
I have a custom editor window. I would like to display the inspector for a selected UnityEngine Object in my editor window. Say for example, a prefab / instantiated gameobject.
I create the editor for the object like this:
Editor objectEditor = Editor.CreateEditor(object);
In my OnGUI function, I call the following 2 functions:
objectEditor.DrawHeader();
objectEditor.OnInspectorGUI();
The header displays ok. But it is the ONLY thing that displays.
OnInspectorGUI
doesn't draw anything.
DrawDefaultInspector
doesn't draw anything either. I tried both of them.
I was expecting to see the transform, attached scripts, material etc.
Can a gameobject's full inspector be drawn in a custom window ? If so, how ?
Answer by Denvery · Aug 02, 2016 at 11:23 AM
Hello!
Please call
objectEditor.DrawDefaultInspector();
instead of or after objectEditor.DrawHeader(); and you can see full inspector
I have tried using:
OnInspectorGUI,
DrawDefaultInspector,
Neither of them worked.
Thanks anyways.
Please see these answers.
http://answers.unity3d.com/questions/427638/call-inspector-on-custom-window-editor.html
The 2nd may explain why we can't draw...