public override void OnInspectorGUI() { base.OnInspectorGUI(); bool focus = UnityEditorInternal.InternalEditorUtility.isApplicationActive; if (focus != focusLastFrame) { OnFocus(focus); } focusLastFrame = focus; var t = target as EditorNoteBehaviour; if (t.file) { if (!hadDataPreviousFrame) { this.OnEnable(); } int linesCount = message.Split('\n').Length; float minHeight = Mathf.Max(50, (linesCount + 2) * lineHeight); var rect = EditorGUILayout.GetControlRect(GUILayout.MinHeight(minHeight), GUILayout.ExpandHeight(true)); message = EditorGUI.TextArea(rect, message); } else if (GUILayout.Button("Create New")) { EditorNoteWindow window = (EditorNoteWindow)EditorWindow.GetWindow(typeof(EditorNoteWindow)); if (window.file) { t.file = window.file; } window.calledBy = this; } }
public static void Init() { EditorNoteWindow window = (EditorNoteWindow)EditorWindow.GetWindow(typeof(EditorNoteWindow)); window.titleContent = new GUIContent("Editor Note"); window.minSize = new Vector2(100, 100); window.Show(); }
public void OnEnable() { var t = target as EditorNoteBehaviour; if (!t.file) { if (EditorWindow.HasOpenInstances <EditorNoteWindow>()) { EditorNoteWindow window = (EditorNoteWindow)EditorWindow.GetWindow(typeof(EditorNoteWindow)); if (window.file) { t.file = window.file; } } } if (t.file) { message = t.file.text; } hadDataPreviousFrame = t.file; }