blob: a474ecf2d37c794565f868c755eb0ade472f9dff (
plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
//https://forum.unity.com/threads/extending-instead-of-replacing-built-in-inspectors.407612/
using System;
using System.Reflection;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(Transform), true)]
[CanEditMultipleObjects]
public class TransformInspector : InspectorExt
{
Transform transform;
bool s_ShowInformation = false;
protected override string defaultEditorName => "UnityEditor.TransformInspector, UnityEditor";
public override void OnEnable()
{
base.OnEnable();
transform = target as Transform;
s_ShowInformation = false;
}
public override void OnDisable()
{
base.OnDisable();
s_ShowInformation = false;
}
public override void OnInspectorGUI()
{
EditorGUILayout.LabelField("Local Space", EditorStyles.boldLabel);
defaultEditor.OnInspectorGUI();
if(BeginMore())
{
// ÊÀ½ç×ø±ê
EditorGUILayout.LabelField("World Space", EditorStyles.boldLabel);
GUI.enabled = false;
EditorGUILayout.Vector3Field("Position", transform.position);
EditorGUILayout.Vector3Field("Rotation", transform.rotation.ToEuler() * Mathf.Rad2Deg);
EditorGUILayout.Vector3Field("Scale", transform.lossyScale);
GUI.enabled = true;
}
EndMore();
}
}
|