/// <summary> /// Similar to the wizard parameterless version, but this wizard /// can work in one of two ways: /// /// editTarget == null: A new variable type will be created /// editTarget != null: An old variable type will be overridden. /// /// Unless the goal is to pass in non-null editTarget, call this /// without parameters. /// </summary> /// <param name="editTarget"> /// Script set to override, if not null. /// </param> public static void CreateWizard(ScriptSetInfo editTarget) { NewVariableTypeWizard wizard = DisplayWizard <NewVariableTypeWizard>( "Create Variable Object Type", "Create" ); if (editTarget != null) { wizard.humanReadableName = editTarget.Name; wizard.dataType = editTarget.TypeName; wizard.referability = editTarget.Referability; wizard.menuOrder = editTarget.MetaData.menuOrder; wizard.builtin = editTarget.MetaData.builtin; wizard.targetFolder = new UnityFolderPath(editTarget.DominantPath); } else { wizard.humanReadableName = ""; wizard.dataType = ""; wizard.referability = ReferabilityMode.Unknown; wizard.menuOrder = 350000; wizard.builtin = false; wizard.targetFolder = new UnityFolderPath(EditorPrefs.GetString(PathPref)); } wizard.editTarget = editTarget; // Force a update...it's possible that, with the parameters we've // passed in, it's valid. Otherwise, it won't detect that it's valid // until the user changes ones of the fields. wizard.OnWizardUpdate(); }
public static void ReopenWizard(NewVariableTypeWizard oldWizard) { NewVariableTypeWizard wizard = DisplayWizard <NewVariableTypeWizard>( "Create Variable Object Type", "Create" ); wizard.humanReadableName = oldWizard.humanReadableName; wizard.dataType = oldWizard.dataType; wizard.referability = oldWizard.referability; wizard.menuOrder = oldWizard.menuOrder; wizard.targetFolder = oldWizard.targetFolder; wizard.editTarget = oldWizard.editTarget; wizard.builtin = oldWizard.builtin; wizard.OnWizardUpdate(); }
public static void CreateWizard( string initName, string initType, ReferabilityMode initMode, string initPath ) { NewVariableTypeWizard wizard = ScriptableWizard.DisplayWizard <NewVariableTypeWizard>( "Create Variable Object Type", "Create" ); wizard.humanReadableName = initName; wizard.dataType = initType; wizard.referability = initMode; wizard.targetFolder = new UnityFolderPath(initPath); // Force a update...it's possible that, with the parameters we've // passed in, it's valid. Otherwise, it won't detect that it's valid // until the user changes ones of the fields. wizard.OnWizardUpdate(); }