ScriptableWizard.DisplayWizard.<T> 显示向导

static function DisplayWizard.<T> (title : string) : T

Parameters参数

Returns

ScriptableWizard - The wizard.

返回T - 该向导。

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.

当用户点击创建按钮,OnWizardCreate函数将被调用。DisplayWizard仅为每个向导类显示一个向导。

ScriptableWizard.DisplayWizard 显示向导

Simple Wizard Window that copies a GameObject several times.
简单的向导窗口,拷贝一个游戏物体几次。

static function DisplayWizard.<T> (title : string, createButtonName : string) : T
static function DisplayWizard.<T> (title : string, createButtonName : string, otherButtonName : string) : T

// C#
// 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);
	}
}
Page last updated: 2011-6-25