public static void InitWindow(Dialogue dialogue) { DialogueEditorWindow window = GetWindow <DialogueEditorWindow>(true, "Dialogue Editor"); window.m_dialogue = dialogue; window.m_dialogueEditor = (DialogueEditor)Editor.CreateEditor(dialogue); window.m_dialogueEditor.isEditorWindow = true; window.Show(); }
public void OnInspectorGUI() { Rect targetRect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight); using (new EditorGUI.DisabledScope(true)) { EditorGUI.ObjectField(targetRect, m_dialogue, typeof(Dialogue), false); } Rect buttonRect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight * 12); if (GUI.Button(buttonRect, "Open Editor")) { DialogueEditorWindow.InitWindow(m_dialogue); } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); Dialogue dialogue = (Dialogue)property.objectReferenceValue; if (dialogue == null) { EditorGUI.PropertyField(position, property, label); } else { Rect propertyRect = new Rect(position.x, position.y, position.width - 105, position.height); Rect buttonRect = new Rect(position.xMax - 100, position.y, 100, position.height); EditorGUI.PropertyField(propertyRect, property, label); if (GUI.Button(buttonRect, "Open Editor", EditorStyles.miniButton)) { DialogueEditorWindow.InitWindow(dialogue); } } EditorGUI.EndProperty(); }