static function PerformUndo () : void
Description
Perform an Undo operation.
This is similar to the user selecting Undo from the Edit menu.
See Also: PerformRedo.
Simple Scriptable Wizard that lets you perform an undo several times.
using UnityEngine;
using UnityEditor;
public class PerformVariousUndo :
ScriptableWizard {
public int numberOfSteps = 5;
[
MenuItem (
"Example/Perform Various Undo %#u")]
static void ExecuteMenu() {
ScriptableWizard.DisplayWizard(
"Perform various Undo at the same time",
typeof(PerformVariousUndo),
"Undo!");
}
void OnWizardCreate() {
int savedNumberOfSteps = numberOfSteps + 1;
for(
int i = 0; i < savedNumberOfSteps; i++) {
Undo.PerformUndo();
}
}
}