private void SelectDatabaseButton() { GUIStyle buttonStyle = EditorStyles.objectField; GUIContent buttonContent = new GUIContent(this.m_Database != null ? this.m_Database.name : "Null"); Rect buttonRect = GUILayoutUtility.GetRect(180f, 18f); buttonRect.y += 1f; if (GUI.Button(buttonRect, buttonContent, buttonStyle)) { ObjectPickerWindow.ShowWindow(buttonRect, typeof(ItemDatabase), (UnityEngine.Object obj) => { this.m_Database = obj as ItemDatabase; ResetChildEditors(); }, () => { ItemDatabase db = EditorTools.CreateAsset <ItemDatabase>(true); if (db != null) { CreateDefaultCategory(db); this.m_Database = db; ResetChildEditors(); } }); } }
protected override void DoSelection(Rect buttonRect, SerializedProperty property, GUIContent label, ItemGroup current) { GUIStyle buttonStyle = EditorStyles.objectField; GUIContent buttonContent = new GUIContent(current != null ? current.Name : "Database"); if (GUI.Button(buttonRect, buttonContent, buttonStyle)) { ObjectPickerWindow.ShowWindow(buttonRect, typeof(ItemDatabase), BuildSelectableObjects(), (UnityEngine.Object obj) => { property.serializedObject.Update(); property.objectReferenceValue = obj; property.serializedObject.ApplyModifiedProperties(); }, () => { }); } }
protected virtual void DoSelection(Rect buttonRect, SerializedProperty property, GUIContent label, Quest current) { GUIStyle buttonStyle = EditorStyles.objectField; GUIContent buttonContent = new GUIContent(current != null ? current.Name : "Null"); if (GUI.Button(buttonRect, buttonContent, buttonStyle)) { ObjectPickerWindow.ShowWindow(buttonRect, typeof(QuestDatabase), BuildSelectableObjects(), (UnityEngine.Object obj) => { property.serializedObject.Update(); property.objectReferenceValue = obj; property.serializedObject.ApplyModifiedProperties(); }, () => { QuestDatabase db = EditorTools.CreateAsset <QuestDatabase>(true); }); } }
private void SelectDatabaseButton() { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Database", GUILayout.Width(120f)); ItemDatabase database = this.m_Database.objectReferenceValue as ItemDatabase; GUIStyle buttonStyle = EditorStyles.objectField; GUIContent buttonContent = new GUIContent(database != null ? database.name : "Null"); Rect buttonRect = GUILayoutUtility.GetRect(buttonContent, buttonStyle); //buttonRect = EditorGUI.PrefixLabel(buttonRect, new GUIContent("Database")); if (GUI.Button(buttonRect, buttonContent, buttonStyle)) { ObjectPickerWindow.ShowWindow(buttonRect, typeof(ItemDatabase), (UnityEngine.Object obj) => { serializedObject.Update(); this.m_Database.objectReferenceValue = obj; serializedObject.ApplyModifiedProperties(); }, () => { }); } EditorGUILayout.EndHorizontal(); }