エディターウィンドウを作成するにはこのクラスから派生します。
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(); } }
| focusedWindow | 現在キーボードフォーカスがある EditorWindow (Read Only) |
| mouseOverWindow | 現在マウスのカーソルの下の EditorWindow (Read Only) |
| autoRepaintOnSceneChange | シーンが変わるたびに自動的にウィンドウを再描画するかどうか |
| maximized | Is this window maximized? |
| maxSize | このウィンドウの最大サイズ |
| minSize | このウィンドウの最小サイズ |
| position | The desired position of the window in screen space. |
| titleContent | GUIContent は EditorWindows のタイトルを描画するために使用します。 |
| wantsMouseEnterLeaveWindow | Checks whether MouseEnterWindow and MouseLeaveWindow events are received in the GUI in this Editor window. |
| wantsMouseMove | Checks whether MouseMove events are received in the GUI in this Editor window. |
| BeginWindows | すべてのポップアップウィンドウを表示するための開始領域をマークします |
| Close | エディターウィンドウを閉じます |
| EndWindows | EditorWindow.BeginWindows で開始したウィンドウグループを閉じます |
| Focus | Moves keyboard focus to another EditorWindow. |
| RemoveNotification | 表示している通知メッセージを停止します |
| Repaint | ウィンドウの再描画を行います |
| SendEvent | Event をウィンドウに送信します |
| Show | Show the EditorWindow window. |
| ShowAsDropDown | ドロップダウンの動作とスタイルを持つウィンドウを表示します |
| ShowAuxWindow | 補助ウィンドウでエディターウィンドウを表示します |
| ShowNotification | 通知メッセージを表示します |
| ShowPopup | ポップアップスタイルのフレーミングを使用するエディターウィンドウを表示します |
| ShowUtility | フローティングのユーティリティウィンドウとしてエディターウィンドウを表示します |
| FocusWindowIfItsOpen | エディターウィンドウが開いている場合に探し出し、最初に見つけたものにフォーカスを当てます |
| GetWindow | 現在画面上にある t タイプの最初に見つけた EditorWindow を返します |
| GetWindowWithRect | 現在画面上にある t タイプの最初に見つけた EditorWindow を返します |
| Awake | 新規ウィンドウが開くときに呼び出されます |
| OnDestroy | OnDestroy is called to close the EditorWindow window. |
| OnFocus | ウィンドウがキーボードフォーカスを取得するときに呼び出されます |
| OnGUI | ここに独自のエディターの GUI を実装します |
| OnHierarchyChange | Handler for message that is sent when an object or group of objects in the hierarchy changes. |
| OnInspectorUpdate | OnInspectorUpdate は更新する機会をインスペクターに与え、秒当たり 10 回呼ばれます |
| OnLostFocus | ウィンドウがキーボードフォーカスを失ったときに呼び出されます |
| OnProjectChange | Handler for message that is sent whenever the state of the project changes. |
| OnSelectionChange | 選択が変更されるたび呼び出されます |
| Update | すべての表示されているウィンドウは秒あたり複数回呼び出されます |
| GetInstanceID | オブジェクトのインスタンス ID を返します |
| ToString | Returns the name of the GameObject. |
| Destroy | ゲームオブジェクトやコンポーネント、アセットを削除します |
| DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
| DontDestroyOnLoad | 新しいシーンを読み込んでもオブジェクトが自動で破壊されないように設定します |
| FindObjectOfType | タイプ type から最初に見つけたアクティブのオブジェクトを返します |
| FindObjectsOfType | タイプから見つけたすべてのアクティブのオブジェクト配列を返します |
| Instantiate | original のオブジェクトをクローンします |
| CreateInstance | ScriptableObject のインスタンスを作成します。 |
| bool | オブジェクトが存在するかどうか |
| operator != | 二つのオブジェクトが異なるオブジェクトを参照しているか比較します |
| operator == | 2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。 |