I’d like to be able to add few buttons to the rectTransform component with an editor script so I made this quick test button -
[CustomEditor(typeof(RectTransform))]
public class RectTransformEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if (GUILayout.Button("Test"))
Debug.Log("Hi!");
DrawDefaultInspector();
}
}
But it seems to break the inspector for the original RectTransform. It goes from this -
To this -
Does anyone know a way to keep the underlying inspector?