Legacy Documentation: Version 5.2
LanguageEnglish
  • C#
  • JS

Script language

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

ScriptableWizard.isValid

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

Sumbission failed

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

Close

Cancel

Switch to Manual
public var isValid: bool;
public bool isValid;

Description

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

See Also: ScriptableWizard.OnWizardUpdate


The finish button gets disabled until the user sets the number to 5.

#pragma strict
// Asks the user to set the var "Number" to 5, if is not set to 5
// the "Finish" button will not be reachable
public class isValidScriptableWizard extends ScriptableWizard {
	public var number: int = 0;
	@MenuItem("Example/Show isValid Usage")
	static function CreateWindow() {
		ScriptableWizard.DisplayWizard("isValid boolean example", isValidScriptableWizard, "Finish");
	}
	function 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;
		}
	}
}
// Asks the user to set the var "Number" to 5, if is not set to 5
// the "Finish" button will not be reachable

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