Version: 2017.2 (switch to 2017.3b)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ScriptableWizard.DisplayWizard

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static method DisplayWizard(title: string): T;
public static T DisplayWizard(string title);

Parameters

title The title shown at the top of the wizard window.

Returns

T The wizard.

Description

Creates a wizard.

When the user hits the Create button OnWizardCreate function will be called. DisplayWizard will only show one wizard for every wizard class.


Simple Wizard window that copies a GameObject several times.

#pragma strict
// Simple Wizard that clones an object.
public class ScriptableWizardDisplayWizard extends ScriptableWizard {
	public var objectToCopy: GameObject = null;
	public var numberOfCopies: int = 2;
	@MenuItem("Example/Show DisplayWizard usage")
	static function CreateWindow() {
		// Creates the wizard for display
		ScriptableWizard.DisplayWizard("Copy an object.", ScriptableWizardDisplayWizard, "Copy!");
	}
	function OnWizardUpdate() {
		helpString = "Clones an object a number of times";
		if (!objectToCopy) {
			errorString = "Please assign an object";
			isValid = false;
		}
		else {
			errorString = "";
			isValid = true;
		}
	}
	function OnWizardCreate() {
		for (var i: int = 0; i < numberOfCopies; i++)
			Instantiate(objectToCopy, Vector3.zero, Quaternion.identity);
	}
}
// Simple Wizard that clones an object.

using UnityEngine; using UnityEditor; using System.Collections;

public class ScriptableWizardDisplayWizard : ScriptableWizard { public GameObject objectToCopy = null; public int numberOfCopies = 2; [MenuItem("Example/Show DisplayWizard usage")] static void CreateWindow() { // Creates the wizard for display ScriptableWizard.DisplayWizard("Copy an object.", typeof(ScriptableWizardDisplayWizard), "Copy!"); }

void OnWizardUpdate() { helpString = "Clones an object a number of times"; if (!objectToCopy) { errorString = "Please assign an object"; isValid = false; } else { errorString = ""; isValid = true; } }

void OnWizardCreate() { for (int i = 0; i < numberOfCopies; i++) Instantiate(objectToCopy, Vector3.zero, Quaternion.identity); } }

public static method DisplayWizard(title: string, createButtonName: string): T;
public static T DisplayWizard(string title, string createButtonName);
public static method DisplayWizard(title: string, createButtonName: string, otherButtonName: string): T;
public static T DisplayWizard(string title, string createButtonName, string otherButtonName);

Parameters

title The title shown at the top of the wizard window.
createButtonName The text shown on the create button.
otherButtonName The text shown on the optional other button. Leave this parameter out to leave the button out.

Returns

T The wizard.

Description

Creates a wizard.

When the user hits the Create button OnWizardCreate function will be called. DisplayWizard will only show one wizard for every wizard class.


public static method DisplayWizard(title: string, klass: Type, createButtonName: string = "Create", otherButtonName: string = ""): ScriptableWizard;
public static ScriptableWizard DisplayWizard(string title, Type klass, string createButtonName = "Create", string otherButtonName = "");

Parameters

title The title shown at the top of the wizard window.
klass The class implementing the wizard. It has to derive from ScriptableWizard.
createButtonName The text shown on the create button.
otherButtonName The text shown on the optional other button. Leave this parameter out to leave the button out.

Returns

ScriptableWizard The wizard.

Description

Creates a wizard.

When the user hits the Create button OnWizardCreate function will be called. DisplayWizard will only show one wizard for every wizard class.

Did you find this page useful? Please give it a rating: