- Home /
Can DrawDefaultInspector keep its formatting?
I'd like to keep this look in a custom inspector:
Instead, if I override the OnInspectorGUI(), the inspector always loses its formatting and I get this:
It's a simple script, so am I missing something?
using UnityEngine; using UnityEditor;
[CustomEditor(typeof(Material))]
public class MaterialInspector : Editor {
public override void OnInspectorGUI()
{
DrawDefaultInspector ();
}
}
Answer by Bunny83 · Apr 04, 2011 at 05:06 PM
DrawDefaultInspector only referes to scripts. It just show all public serialized fields with the default type-editor in list form. Any special layout have to be created by yourself. Extending such special layouts (almost all built in components like Transform, Renderer, Material ....) is not posible. You would have to create your own editor from scratch. Some things are really tricky, like arrays, but it is possible if you have the time ;)
Your answer
Follow this Question
Related Questions
Edit an object in isolation quickly, as in the new Prefab Mode 0 Answers
How to access Custom Inspector own gameObject 1 Answer
Reorderable list of UnityEvents 2 Answers
Custom Inspector resets after Unity restarts 0 Answers
What is a GUILayoutOption[] 3 Answers