Last active
December 27, 2015 17:18
-
-
Save cician/7360936 to your computer and use it in GitHub Desktop.
Transform editor rendering the original Unity's editor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment