Derive from this class to create an editor wizard.
Editor wizards are typically opened using a menu item.
// 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 | Allows you to set the text shown on the create button of the wizard. |
errorString | Allows you to set the error text of the wizard. |
helpString | Allows you to set the help text of the wizard. |
isValid | Allows you to enable and disable the wizard create button, so that the user can not click it. |
otherButtonName | Allows you to set the text shown on the optional other button of the wizard. Leave this parameter out to leave the button out. |
DrawWizardGUI | Will be called for drawing contents when the ScriptableWizard needs to update its GUI. |
DisplayWizard | Creates a wizard. |
OnWizardCreate | This is called when the user clicks on the Create button. |
OnWizardOtherButton | Allows you to provide an action when the user clicks on the other button. |
OnWizardUpdate | This is called when the wizard is opened or whenever the user changes something in the wizard. |
focusedWindow | The EditorWindow which currently has keyboard focus. (Read Only) |
mouseOverWindow | The EditorWindow currently under the mouse cursor. (Read Only) |
autoRepaintOnSceneChange | Does the window automatically repaint whenever the Scene has changed? |
docked | Returns true if EditorWindow is docked. |
hasFocus | Returns true if EditorWindow is focused. |
hasUnsavedChanges | When 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. |
maximized | Is this window maximized? |
maxSize | The maximum size of this window. |
minSize | The minimum size of this window. |
position | The desired position of the window in screen space. |
rootVisualElement | Retrieves the root visual element of this window hierarchy. |
saveChangesMessage | The message that displays to the user if they are prompted to save |
titleContent | The GUIContent used for drawing the title of EditorWindows. |
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 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. |
GetExtraPaneTypes | Gets the extra panes associated with the window. |
RemoveNotification | Stop showing notification message. |
Repaint | Make the window repaint. |
SaveChanges | Performs a save action on the contents of the window. |
SendEvent | Sends an Event to a window. |
Show | Show the EditorWindow window. |
ShowAsDropDown | Shows a window with dropdown behaviour and styling. |
ShowAuxWindow | Show the editor window in the auxiliary window. |
ShowModal | Show modal editor window. |
ShowModalUtility | Show the EditorWindow as a floating modal window. |
ShowNotification | Show a notification message. |
ShowPopup | Shows an Editor window using popup-style framing. |
ShowUtility | Show the EditorWindow as a floating utility window. |
CreateWindow | Creates an EditorWindow of type T. |
FocusWindowIfItsOpen | Focuses the first found EditorWindow of specified type if it is open. |
GetWindow | Returns the first EditorWindow of type t which is currently on the screen. |
GetWindowWithRect | Returns the first EditorWindow of type t which is currently on the screen. |
HasOpenInstances | Checks if an editor window is open. |
Awake | Called as the new window is opened. |
hasUnsavedChanges | When 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. |
OnDestroy | OnDestroy is called to close the EditorWindow window. |
OnFocus | Called when the window gets keyboard focus. |
OnGUI | Implement your own editor GUI here. |
OnHierarchyChange | Handler for message that is sent when an object or group of objects in the hierarchy changes. |
OnInspectorUpdate | OnInspectorUpdate is called at 10 frames per second to give the inspector a chance to update. |
OnLostFocus | Called when the window loses keyboard focus. |
OnProjectChange | Handler for message that is sent whenever the state of the project changes. |
OnSelectionChange | Called whenever the selection has changed. |
saveChangesMessage | The message that displays to the user if they are prompted to save |
Update | Called multiple times per second on all visible windows. |