- Home /
Is it possible to call a custom inspector?
So, lets assume I got a working custom inspector and I like it.
Now I create a custom window which contains a list of buttons which correlate to a custom class. How can I get a custom class's inspector to get in the window? I have been looking into serialized object and I didn't see anything in regards to calling the property field to present the custom inspector.
Anyone, have any ideas how to do this?
I feel it should be something to do with this, but it doesn't add an option for editor override. EditorGUI.ObjectField
Answer by SilentSin · Jan 20, 2015 at 05:42 AM
You can look into making a property drawer for your custom class or you can call Editor.CreateEditor and call stuff on it.
I have tired. I am even doing a very simple one. Property drawer works, but when I try to insert the object into the window it wants me to plug in a reference of the object(similar to the script reference in all objects in the inspector)
Hey you were right, I was doing it incorrectly however.
I figured it out with help from http://stackoverflow.com/questions/16054955/unity-custom-inspector-on-custom-window
This is what I was looking for...
Editor editor = Editor.CreateEditor(_item); // _item = new Item();
editor.OnInspectorGUI();
I saw it, but was missing the part where I had to call that editors draw method.
Your answer
Follow this Question
Related Questions
what does @CustomEditor do ? 1 Answer
Custom Editor Search bar 2 Answers
Custom inspector variable resets automatically 1 Answer
Animation field in custom inspector. 1 Answer