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(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( 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( tObj, allowSceneObjects, "", pickerID); } if (Event.current.commandName == "ObjectSelectorUpdated") { if (EditorGUIUtility.GetObjectPickerControlID() == pickerID) { tObj = EditorGUIUtility.GetObjectPickerObject() as T; value.objectReferenceValue = tObj; } } } } }