Created
November 24, 2016 10:41
-
-
Save anonymous/8642617300dbaa9c0ff50887660a7baf to your computer and use it in GitHub Desktop.
This file contains hidden or 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; | |
using System; | |
[CanEditMultipleObjects, CustomEditor(typeof(Transform), true)] | |
public class TransformCustom : Editor | |
{ | |
protected bool m_showWorld = false; | |
protected Transform m_target; | |
protected Editor m_originalEditor; | |
private void OnEnable() | |
{ | |
m_showWorld = false; | |
m_target = target as Transform; | |
Type t = Type.GetType("UnityEditor.TransformInspector,UnityEditor"); | |
m_originalEditor = Editor.CreateEditor(target, t); | |
} | |
public override void OnInspectorGUI() | |
{ | |
m_originalEditor.OnInspectorGUI(); | |
m_showWorld = EditorGUILayout.Foldout(m_showWorld, "World Data"); | |
if(m_showWorld) | |
{ | |
GUI.enabled = false; | |
EditorGUILayout.Vector3Field("Position", m_target.position); | |
EditorGUILayout.Vector3Field("Rotation", m_target.rotation.eulerAngles); | |
GUI.enabled = true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment