Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ScriptableWizard

Derive from this class to create an editor wizard.
Read time 8 minutesLast updated 4 days ago

Definition

public class ScriptableWizard : EditorWindow

Remarks

Editor wizards are typically opened using a menu item.

Examples

// 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 redusing 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; } } }}

Properties

Property

Description

createButtonNameAllows you to set the text shown on the create button of the wizard.
errorStringAllows you to set the error text of the wizard.
helpStringAllows you to set the help text of the wizard.
isValidAllows you to enable and disable the wizard create button, so that the user can not click it.
otherButtonNameAllows you to set the text shown on the optional other button of the wizard. Leave this parameter out to leave the button out.

Methods

Method

Description

DrawWizardGUIWill be called for drawing contents when the ScriptableWizard needs to update its GUI.
OnWizardCreateThis is called when the user clicks on the Create button.
OnWizardOtherButtonAllows you to provide an action when the user clicks on the other button.
OnWizardUpdateThis is called when the wizard is opened or whenever the user changes something in the wizard.

Static Methods

Method

Description

DisplayWizardCreates a wizard.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.