Version: 2020.3
言語: 日本語

ScriptableWizard

class in UnityEditor

/

継承:EditorWindow

マニュアルに切り替える

説明

エディターウィザードを作成するにはこのクラスを継承します。

エディターウィザードは、メニューから開きます。

// Creates a simple wizard that lets you create a Light GameObject
// or if the user clicks in "Apply", it will set the color of the currently
// object selected to red

using UnityEditor; using UnityEngine;

public class WizardCreateLight : ScriptableWizard { public float range = 500; public Color color = Color.red;

[MenuItem("GameObject/Create Light Wizard")] static void CreateWizard() { ScriptableWizard.DisplayWizard<WizardCreateLight>("Create Light", "Create", "Apply"); //If you don't want to use the secondary button simply leave it out: //ScriptableWizard.DisplayWizard<WizardCreateLight>("Create Light", "Create"); }

void OnWizardCreate() { GameObject go = new GameObject("New Light"); Light lt = go.AddComponent<Light>(); lt.range = range; lt.color = color; }

void OnWizardUpdate() { helpString = "Please set the color of the light!"; }

// When the user presses the "Apply" button OnWizardOtherButton is called. void OnWizardOtherButton() { if (Selection.activeTransform != null) { Light lt = Selection.activeTransform.GetComponent<Light>();

if (lt != null) { lt.color = Color.red; } } } }

変数

createButtonNameウィザードの Creat ボタンに表示されるテキストを設定することができます
errorStringウィザードのエラーテキストを設定することができます
helpStringウィザードのヘルプテキストを設定することができます。
isValid有効にするとウィザードの Creat ボタンを無効にし、ユーザーはそれをクリックできません
otherButtonNameウィザードの第3選択肢のボタンとして表示されるテキストを設定することができます ボタンを除外するためにはこのパラメーターを省略します

Protected 関数

DrawWizardGUIScriptableWizard が GUI を更新する必要があるとき、内容を描画するために呼び出されます。

Static 関数

DisplayWizardウィザードを作成します。

メッセージ

OnWizardCreateこれはユーザーが Creat ボタンを押したときに呼び出されます。
OnWizardOtherButtonユーザーが他のボタンをクリックしたときにアクションを提供できます
OnWizardUpdateウィザードを開いたときやユーザーがウィザードで何かを変更するたびに呼び出されます

継承メンバー

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.
hasUnsavedChangesWhen set to true in a derived class, the editor will prompt the user to save unsaved changes if the window is about to be closed.
maximizedIs this window maximized?
maxSizeこのウィンドウの最大サイズ
minSizeこのウィンドウの最小サイズ
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.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameオブジェクト名

Public 関数

BeginWindowsすべてのポップアップウィンドウを表示するための開始領域をマークします
Closeエディターウィンドウを閉じます
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フローティングのユーティリティウィンドウとしてエディターウィンドウを表示します
GetInstanceIDオブジェクトのインスタンス ID を返します
ToStringReturns the name of the object.

Static 関数

CreateWindowCreates an EditorWindow of type T.
FocusWindowIfItsOpenエディターウィンドウが開いている場合に探し出し、最初に見つけたものにフォーカスを当てます
GetWindow現在画面上にある t タイプの最初に見つけた EditorWindow を返します
GetWindowWithRect現在画面上にある t タイプの最初に見つけた EditorWindow を返します
HasOpenInstancesChecks if an editor window is open.
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新規ウィンドウが開くときに呼び出されます
CreateGUICreateGUI is called when the EditorWindow's rootVisualElement is ready to be populated.
hasUnsavedChangesWhen set to true in a derived class, the editor will prompt the user to save unsaved changes if the window is about to be closed.
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すべての表示されているウィンドウは秒あたり複数回呼び出されます
Awake ScriptableObject スクリプトを開始するとき、この関数は呼び出されます。
OnDestroyScriptableObject が破棄されるとき、この関数は呼び出されます。
OnDisableScriptableObject クラスのオブジェクトがスコープを外れるとき、この関数は呼び出されます。
OnEnableオブジェクトがロードされたとき、この関数は呼び出されます。
OnValidateEditor-only function that Unity calls when the script is loaded or a value changes in the Inspector.
Resetデフォルト値にリセットします