Hi, I’m trying to make a Unity Custom Editor for the GameObject Class. I’d like it to look just like the Untiy Custom inspector pictured below with an extra button showing beneath it.
So I thought I’d call DrawDefaultInspector because that will draw what it looks like by default using the following code:
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(GameObject))]
public class InspectorNewScriptButton : Editor
{
public override void OnInspectorGUI()
{
DrawDefaultInspector();
if(GUILayout.Button("Press Me")
Debug.Log("Pressed");
}
}
Instead however… I ended up with this mess:
How would I go about making my custom script look/work like Unity’s Custom Default not the real default and then add an additional button to it? Is there a call to Unity’s Custom Inspector that I’m not aware of?