- Home /
Custom Editor for GameObject Class look like Unity's Custom Inspector for GameObject?
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?
Your answer
Follow this Question
Related Questions
using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers
[Editor Scripting] Call Function in other GameObjects Editor Script? 0 Answers
How to find all gameObjects in a bounding area? 2 Answers
How to show preview tile even when i don't select the gameobject in the hierachy? 0 Answers