Unity editor development - EditorWindow

Official Documentation: EditorWindow - Unity Scripting API

EditorWindow inherits from   ScriptableObject

1. Variables

1. Static variables

variable name official explanation scenes to be used
focusWindow The EditorWindow that currently has the keyboard focus. (read only)
mouseOverWindow The EditorWindow currently under the mouse cursor. (read only)

2. Variables

variable name official explanation scenes to be used
titleContent The GUIContent used to draw the EditorWindow's title.
position The desired position of the window in screen space.
maxSize window maximum
minSize window minimum
maximized Is this window maximized?
rootVisualElement Get the root visual element of the window hierarchy view.
hasFocus whether the window is focused
autoRepaintOnSceneChange Will the window redraw automatically every time the scene changes?
docked Returns true if EditorWindow is docked.
hasUnsavedChanges This property specifies whether the Editor prompts the user to save or discard unsaved changes before the window closes.
saveChangesMessage The message that displays to the user if they are prompted to save
wantsLessLayoutEvents Specifies whether a layout pass is performed before all user events (for example, EventType.MouseDown or [[EventType, KeyDown]]), or is only performed before repaint events.
wantsMouseEnterLeaveWindow Checks that MouseEnterWindow and MouseLeaveWindow events have been received in the GUI for this editor window.
wantsMouseMove Checks to see if MouseMove events have been received in the GUI of this editor window.

2. Method

1. Protected methods

variable name official explanation scenes to be used
OnBackingScaleFactorChanged Called when the UI scaling for this EditorWindow is changed.

2. Static method

variable name official explanation scenes to be used
CreateWindow Creates an EditorWindow of type T.
FocusWindowIfItsOpen Focuses the first found EditorWindow of the specified type (if already open).
GetWindow Returns the first EditorWindow of type t on the current screen.
GetWindowWithRect Returns the first EditorWindow of type t on the current screen.
HasOpenInstances Checks if an editor window is open.

3. Method

BeginWindows Marks the start area of ​​all popup windows.
Close Close the editor window.
DiscardChanges Discards unsaved changes to the contents of the window.
EndWindows Closes the window group started by EditorWindow.BeginWindows.
Focus Move the keyboard focus to another EditorWindow.
GetExtraPaneTypes Get the extra panes associated with the window.
RemoveNotification Stop showing notification messages.
Repaint Repaints the window.
SaveChanges Performs a save action on the contents of the window.
SendEvent 将事件发送到窗口。
Show 显示 EditorWindow 窗口。
ShowAsDropDown 显示包含下拉菜单和样式的窗口。
ShowAuxWindow 在辅助窗口中显示编辑器窗口。
ShowModal 显示模态编辑器窗口。
ShowModalUtility 将 EditorWindow 显示为浮动模态窗口。
ShowNotification 显示通知消息。
ShowPopup 使用弹出式框架显示编辑器窗口。
ShowUtility 将 EditorWindow 显示为浮动实用程序窗口。
TryGetOverlay Get an Overlay with matching ID from an EditorWindow canvas.

三、消息(生命周期)

Awake 在新窗口打开时调用。
CreateGUI CreateGUI is called when the EditorWindow's rootVisualElement is ready to be populated.
hasUnsavedChanges This property specifies whether the Editor prompts the user to save or discard unsaved changes before the window closes.
OnDestroy 调用 OnDestroy 以关闭 EditorWindow 窗口。
OnFocus 在窗口获得键盘焦点时调用。
OnGUI 在此处实现您自己的 Editor GUI。
OnHierarchyChange 处理程序,用于在层级视图中的对象或对象组发生更改时发送的消息。
OnInspectorUpdate OnInspectorUpdate 以每秒 10 帧的速度调用,以便检视面板有机会进行更新。
OnLostFocus Called when a window loses keyboard focus.
OnProjectChange Handler for messages sent when the item state changes.
OnSelectionChange Called whenever the selection changes.
saveChangesMessage The message that displays to the user if they are prompted to save
Update Called multiple times per second on all visible windows.

Guess you like

Origin blog.csdn.net/qq_38074938/article/details/131619372
Recommended