How to access a Custom Editor components

I’m creating Editors via script using the method

Editor.CreateEditor(Selection.gameObjects);

And I can access the Header displayed on the inspector pretty easy like so:

editor.DrawHeader();

For the components I thought using:

editor.OnInspectorGUI();

And I thought it would do exactly what I wanted, but sadly It does nothing, possible because It’s a virtual method and has not been override with anything and there’s no way of doing it since I’m creating these editors via script like I mention before.

Also using:

editor.DrawDefaultInspector();

Won’t draw the nice/flashy compact inspector we are use to. So I thought I’d seek out help, anything will be much appreciated.

Oh also using the serializedObject from the editor itself has been futile.

A little breakthrough, I found a way to access the components but I can’t edit multiple objects yet, heres the code:

SerializedObject s = editor.serializedObject;
SerializedProperty components = s.FindProperty("m_Component");
SerializedProperty componentProperty = null;

s.Update();
for (int i = 0; i < components.arraySize; i++)
{
    componentProperty = components.GetArrayElementAtIndex(i).FindPropertyRelative("component");
    Editor comEditor = Editor.CreateEditor(componentProperty.objectReferenceValue);
    componentProperty.isExpanded = EditorGUILayout.InspectorTitlebar(componentProperty.isExpanded, comEditor);
            
    if (componentProperty.isExpanded)
    {
        comEditor.OnInspectorGUI();
    }
}
s.ApplyModifiedProperties();