允许您启用向导 Create 按钮,或者将其禁用,从而使用户无法点击。
另请参阅:ScriptableWizard.OnWizardUpdate
\
Finish 按钮处于禁用状态,直至用户将数值设置为 5。
// 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; } } }