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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace TweenAnimation
{
[CustomEditor(typeof(TweenAnimation), false)]
public partial class TweenAnimationInspector : Editor
{
public override void OnInspectorGUI()
{
TweenAnimation tween = target as TweenAnimation;
EditorGUILayout.LabelField("Tween Alpha", TweenModuleGUIStyles.Get().moduleHeaderStyle);
// GUILayout.Button("button", "ProfilerBadge");
//DrawProObjectField<TweenAnimation>(new GUIContent(""), tween, typeof(TweenAnimation), TweenModuleGUIStyles.Get().objectField, false);
Rect rect = GUILayoutUtility.GetRect(100, 25f);
bool result = GUI.Toggle(rect, true, "content", TweenModuleGUIStyles.Get().moduleHeaderStyle);
rect = GUILayoutUtility.GetRect(100, 25f);
GUI.Button(rect, "", "OL Plus");
rect.y += 20;
GUI.Button(rect, "", "OL Minus");
}
public static void DrawProObjectField<T>(
GUIContent label,
SerializedProperty value,
Type objType,
GUIStyle style,
bool allowSceneObjects,
Texture objIcon = null,
params GUILayoutOption[] options) where T : UnityEngine.Object
{
T tObj = value.objectReferenceValue as T;
if (objIcon == null)
{
objIcon = EditorGUIUtility.FindTexture("PrefabNormal Icon");
}
style.imagePosition = ImagePosition.ImageLeft;
int pickerID = 455454425;
if (tObj != null)
{
EditorGUILayout.LabelField(label,
new GUIContent(tObj.name, objIcon), style, options);
}
if (GUILayout.Button("Select"))
{
EditorGUIUtility.ShowObjectPicker<T>(
tObj, allowSceneObjects, "", pickerID);
}
if (Event.current.commandName == "ObjectSelectorUpdated")
{
if (EditorGUIUtility.GetObjectPickerControlID() == pickerID)
{
tObj = EditorGUIUtility.GetObjectPickerObject() as T;
value.objectReferenceValue = tObj;
}
}
}
}
}
|