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

参数

title 显示在向导窗口顶部的标题。

返回

T 向导。

描述

创建一个向导。

当用户点按 Create 按钮时,将调用 OnWizardCreate 函数。 DisplayWizard 将仅针对每个向导类显示一个向导。

\ 多次复制一个游戏对象的简单向导窗口。

// 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 显示在向导窗口顶部的标题。
createButtonName Create 按钮上显示的文本。
otherButtonName 可选 Other 按钮上显示的文本。忽略此参数将不显示该按钮。

返回

T 向导。

描述

创建一个向导。

当用户点按 Create 按钮时,将调用 OnWizardCreate 函数。 DisplayWizard 将仅针对每个向导类显示一个向导。


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

参数

title 显示在向导窗口顶部的标题。
klass 实现向导的类。它必须派生自 ScriptableWizard
createButtonName Create 按钮上显示的文本。
otherButtonName 可选 Other 按钮上显示的文本。忽略此参数将不显示该按钮。

返回

ScriptableWizard 向导。

描述

创建一个向导。

当用户点按 Create 按钮时,将调用 OnWizardCreate 函数。 DisplayWizard 将仅针对每个向导类显示一个向导。


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