Skip to content

Instantly share code, notes, and snippets.

Created November 24, 2016 10:41
Show Gist options
  • Save anonymous/8642617300dbaa9c0ff50887660a7baf to your computer and use it in GitHub Desktop.
Save anonymous/8642617300dbaa9c0ff50887660a7baf to your computer and use it in GitHub Desktop.
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