This functionality has since been added in Unity 4!
See: http://docs.unity3d.com/Documentation/ScriptReference/Editor.CreateEditor.html
Several weeks ago I had some ideas that would add lots of flexibility to my custom editor window. In a nutshell the idea was to add, modify and remove certain components. To be honest I thought that this would be relatively easy because this functionality is already available within Unity inspector windows. I remembered seeing `EditorGUILayout.PropertyField` and I foolishly assumed that would do the trick, but I was wrong…
My next attempt was to enumerate component properties using `SerializedObject` and `SerializedProperty`. Whilst this approach did in fact provide something that resembled a custom inspector, it was extremely lacking. When I realised, this couldn’t possibly utilise custom editors!
For example, the `Transform` component has a custom inspector which is tailored specifically for it. In Rotorz Tile System we use a custom inspector on `RotorzTileSystem` components which allows properties to be modified and actions to be performed. These custom inspectors are easily defined using the `CustomEditor` attribute. So the idea here is to reuse these custom editors (which are not necessarily created by myself) within my editor window!
With thanks to MonoDevelop’s fantastic assembly browser I came across the undocumented class `UnityEditor.ActiveEditorTracker`. The publicly exposed methods are well named and fairly self-explanatory. So I had a go at creating a rough mockup of a custom inspector. I was pleasantly surprised at how easy this had now become. Creating a rudimentary custom inspector is as simple as shown below:
using UnityEngine;
using UnityEditor;
public class CustomWindow : EditorWindow {
[MenuItem("Window/Test")]
public static void Test() {
EditorWindow.GetWindow<CustomWindow>("Test");
}
GameObject activeGO;
Editor editor;
void Update() {
if (activeGO == Selection.activeGameObject)
return;
activeGO = Selection.activeGameObject;
editor = null;
if (activeGO != null)
editor = UnityEditor.ActiveEditorTracker.MakeCustomEditor(activeGO.transform);
Repaint();
}
void OnGUI() {
GameObject go = Selection.activeGameObject;
if (go == null)
return;
// Use the registered editor for `Transform`
EditorGUILayout.InspectorTitlebar(true, editor.target);
editor.OnInspectorGUI();
}
}
Unfortunately this functionality is not currently documented and as such cannot be used in a commercial Unity extension because there is no guarantee that it will continue to work in future versions of Unity. This is a great shame because I could put this to good use! I also suspect that the developers of PlayMaker could utilise this functionality if it were documented for customisable action GUIs.
Please consider voting for Unity Technologies to add a basic level of documentation for this functionality 
http://feedback.unity3d.com/unity/all-categories/1/hot/active/document-unityeditoractiveedi