下面脚本解决UGUI编辑时看不到世界坐标和相对坐标的问题
[CustomEditor(typeof(RectTransform))] public class MyRectTransformEditor : Editor { private Editor editor; Transform tagetTranform; private void OnEnable() { editor = Editor.CreateEditor(target, Assembly.GetAssembly(typeof(Editor)).GetType("UnityEditor.RectTransformEditor", true)); tagetTranform = target as RectTransform; } public override void OnInspectorGUI() { editor.OnInspectorGUI(); tagetTranform.position = EditorGUILayout.Vector3Field("世界坐标:", tagetTranform.position); tagetTranform.localPosition = EditorGUILayout.Vector3Field("相对坐标:", tagetTranform.localPosition); } }