ScriptableWizard.isValid 是否有效

var isValid : bool

Description描述

Allows you to enable and disable the wizard create button, so that the user can not click it.

允许您启用和禁用向导创建按钮,以便用户不能点击。

参见:ScriptableWizard.OnWizardUpdate

ScriptableWizard.isValid 是否有效

The finish button gets disabled until the user sets the number to 5
Finish按钮被禁用,直到用户设置数为5

// C#
// Asks the user to set the var "Number" to 5, if is not set to 5
// the "Finish" button will not be reachable
//询问用户来设置变量"Number"为5,如果不设置为5
//则"Finish"按钮将不可用
using UnityEngine;
using UnityEditor;

public class isValidScriptableWizard : ScriptableWizard {
	public int number = 0;
	[MenuItem ("Example/Show isValid Usage")]
	static void CreateWindow() {
		ScriptableWizard.DisplayWizard(
			"isValid boolean example",
			typeof(isValidScriptableWizard),
			"Finish");
	}
	void OnWizardUpdate() {
		helpString = "Set The number to 5 and press finish";
		if(number != 5) {
			errorString = "The number has to be set to 5!";
			isValid = false;
		} else {
			errorString = "";
			isValid = true;
		}
	}
}
最后修改:2011年6月25日 Saturday 12:04

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。