Version: 2022.1
言語: 日本語

EditorWindow

class in UnityEditor

/

継承:ScriptableObject

マニュアルに切り替える

説明

エディターウィンドウを作成するにはこのクラスから派生します。

Unity インターフェースの中のネイティブのウィンドウと同様にタブとしてドッキングしたり自由に浮かせることができるカスタムのエディターウィンドウを作成します。

通常メニュー項目を使用してエディターウィンドウを開きます。

using UnityEngine;
using UnityEditor;

public class MyWindow : EditorWindow { string myString = "Hello World"; bool groupEnabled; bool myBool = true; float myFloat = 1.23f;

// Add menu named "My Window" to the Window menu [MenuItem("Window/My Window")] static void Init() { // Get existing open window or if none, make a new one: MyWindow window = (MyWindow)EditorWindow.GetWindow(typeof(MyWindow)); window.Show(); }

void OnGUI() { GUILayout.Label("Base Settings", EditorStyles.boldLabel); myString = EditorGUILayout.TextField("Text Field", myString);

groupEnabled = EditorGUILayout.BeginToggleGroup("Optional Settings", groupEnabled); myBool = EditorGUILayout.Toggle("Toggle", myBool); myFloat = EditorGUILayout.Slider("Slider", myFloat, -3, 3); EditorGUILayout.EndToggleGroup(); } }

Static 変数

focusedWindow現在キーボードフォーカスがある EditorWindow (Read Only)
mouseOverWindow現在マウスのカーソルの下の EditorWindow (Read Only)

変数

autoRepaintOnSceneChangeDoes the window automatically repaint whenever the Scene has changed?
dockedReturns true if EditorWindow is docked.
hasFocusReturns true if EditorWindow is focused.
hasUnsavedChangesThis property specifies whether the Editor prompts the user to save or discard unsaved changes before the window closes.
maximizedIs this window maximized?
maxSizeThe maximum size of this window when it is floating or modal. The maximum size is not used when the window is docked.
minSizeThe minimum size of this window when it is floating or modal. The minimum size is not used when the window is docked.
overlayCanvasThe OverlayCanvas for this window.
positionThe desired position of the window in screen space.
rootVisualElementRetrieves the root visual element of this window hierarchy.
saveChangesMessageThe message that displays to the user if they are prompted to save
titleContentGUIContent は EditorWindows のタイトルを描画するために使用します。
wantsLessLayoutEventsSpecifies whether a layout pass is performed before all user events (for example, EventType.MouseDown or [[EventType, KeyDown]]), or is only performed before repaint events.
wantsMouseEnterLeaveWindowChecks whether MouseEnterWindow and MouseLeaveWindow events are received in the GUI in this Editor window.
wantsMouseMoveChecks whether MouseMove events are received in the GUI in this Editor window.

Public 関数

BeginWindowsすべてのポップアップウィンドウを表示するための開始領域をマークします
Closeエディターウィンドウを閉じます
DiscardChangesDiscards unsaved changes to the contents of the window.
EndWindows EditorWindow.BeginWindows で開始したウィンドウグループを閉じます
FocusMoves keyboard focus to another EditorWindow.
GetExtraPaneTypesGets the extra panes associated with the window.
RemoveNotification表示している通知メッセージを停止します
Repaintウィンドウの再描画を行います
SaveChangesPerforms a save action on the contents of the window.
SendEventEvent をウィンドウに送信します
ShowShow the EditorWindow window.
ShowAsDropDownドロップダウンの動作とスタイルを持つウィンドウを表示します
ShowAuxWindow補助ウィンドウでエディターウィンドウを表示します
ShowModalShow modal editor window.
ShowModalUtilityShow the EditorWindow as a floating modal window.
ShowNotification通知メッセージを表示します
ShowPopupポップアップスタイルのフレーミングを使用するエディターウィンドウを表示します
ShowUtilityフローティングのユーティリティウィンドウとしてエディターウィンドウを表示します
TryGetOverlayGet an Overlay with matching ID from an EditorWindow canvas.

Protected 関数

OnBackingScaleFactorChangedCalled when the UI scaling for this EditorWindow is changed.

Static 関数

CreateWindowCreates an EditorWindow of type T.
FocusWindowIfItsOpenエディターウィンドウが開いている場合に探し出し、最初に見つけたものにフォーカスを当てます
GetWindow現在画面上にある t タイプの最初に見つけた EditorWindow を返します
GetWindowWithRect現在画面上にある t タイプの最初に見つけた EditorWindow を返します
HasOpenInstancesChecks if an editor window is open.

メッセージ

Awake新規ウィンドウが開くときに呼び出されます
CreateGUICreateGUI is called when the EditorWindow's rootVisualElement is ready to be populated.
hasUnsavedChangesThis property specifies whether the Editor prompts the user to save or discard unsaved changes before the window closes.
OnDestroyOnDestroy is called to close the EditorWindow window.
OnFocusウィンドウがキーボードフォーカスを取得するときに呼び出されます
OnGUIここに独自のエディターの GUI を実装します
OnHierarchyChangeHandler for message that is sent when an object or group of objects in the hierarchy changes.
OnInspectorUpdateOnInspectorUpdate は更新する機会をインスペクターに与え、秒当たり 10 回呼ばれます
OnLostFocusウィンドウがキーボードフォーカスを失ったときに呼び出されます
OnProjectChangeHandler for message that is sent whenever the state of the project changes.
OnSelectionChange選択が変更されるたび呼び出されます
saveChangesMessageThe message that displays to the user if they are prompted to save
Updateすべての表示されているウィンドウは秒あたり複数回呼び出されます

継承メンバー

変数

hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameオブジェクト名

Public 関数

GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

Static 関数

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfTypeタイプ type から最初に見つけたアクティブのオブジェクトを返します
FindObjectsOfTypeGets a list of all loaded objects of Type type.
Instantiateoriginal のオブジェクトをクローンします
CreateInstanceScriptableObject のインスタンスを作成します。

Operator

boolオブジェクトが存在するかどうか
operator !=二つのオブジェクトが異なるオブジェクトを参照しているか比較します
operator ==2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。

メッセージ

Awake ScriptableObject スクリプトを開始するとき、この関数は呼び出されます。
OnDisableScriptableObject クラスのオブジェクトがスコープを外れるとき、この関数は呼び出されます。
OnEnableオブジェクトがロードされたとき、この関数は呼び出されます。
OnValidateEditor-only function that Unity calls when the script is loaded or a value changes in the Inspector.
Resetデフォルト値にリセットします