ScriptableWizard Class, inherits from EditorWindowDerive from this class to create an editor wizard.
Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script. Editor wizards are typically opened using a menu item. // C# example:
using UnityEditor; using UnityEngine; class WizardCreateLight : ScriptableWizard { public float range = 500; public Color color = Color.red; [MenuItem ("GameObject/Create Light Wizard")] static void CreateWizard () { ScriptableWizard.DisplayWizard("Create Light", typeof (WizardCreateLight), "Create", "Apply"); //If you don't want to use the secondary button simply leave it out: //ScriptableWizard.DisplayWizard("Create Light", typeof(WizardCreateLight)); } void OnWizardCreate () { GameObject go = new GameObject ("New Light"); go.AddComponent("Light"); go.light.range = range; go.light.color = color; } void OnWizardUpdate () { helpString = "Please set the color of the light!"; } // When the user pressed the "Apply" button OnWizardOtherButton is called. void OnWizardOtherButton () { // Simply set the color of the selected light to red. if (Selection.activeTransform == null) return; if (Selection.activeTransform.light == null) return; Selection.activeTransform.light.color = Color.red; } } Variables
Messages Sent
Class Functions
Inherited members
Inherited Variables
Inherited Functions
Inherited Messages Sent
Inherited Class Variables
Inherited Class Functions
|
