Version: 5.6
public static T DisplayWizard (string title);

파라미터

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

반환

T The wizard.

설명

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.

// 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 T DisplayWizard (string title, string createButtonName);
public static T DisplayWizard (string title, string createButtonName, string otherButtonName);

파라미터

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.

반환

T The wizard.

설명

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 ScriptableWizard DisplayWizard (string title, Type klass, string createButtonName= "Create", string otherButtonName= "");

파라미터

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.

반환

ScriptableWizard The wizard.

설명

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.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961