Quick post: Unity editor wrapper
I’ve seen people reverse engineer the transform editor or doing their own thing.
In Unity 4 you can render the original editor inside yours as long as you have
the original editors type.
Here’s an example for a transform editor wrapper, but you can wrap anything you
want, like a MeshRenderer or a TextureImporter (haven’t tried yet).
You may want to wrap other Editor methods besides OnInspectorGUI as well.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(Transform))]
public class TransformEditorWrapper : Editor {
Editor transformEditor;
void OnEnable() {
Transform transform = target as Transform;
System.Type t = typeof(UnityEditor.EditorApplication).Assembly.GetType("UnityEditor.TransformInspector");
transformEditor = Editor.CreateEditor(transform, t);
}
public override void OnInspectorGUI() {
GUI.changed = false;
transformEditor.OnInspectorGUI();
Transform transform = target as Transform;
GUILayout.Label("WRAPPED!");
// do your stuff here...
}
void OnDisable() {
DestroyImmediate(transformEditor);
}
}