Description
The AddUndo
method is used to register an undo action within the SceneEditorSession
. This method allows you to specify a name for the undo action, as well as the actions to perform for undoing and redoing the changes. This is particularly useful in an editor environment where changes need to be reversible.
Usage
To use the AddUndo
method, you need to provide a descriptive name for the undo action, along with two System.Action
delegates that define the operations to be performed when the action is undone and redone.
Ensure that the actions provided are idempotent and correctly reverse the changes made to the scene or objects within the scene.
Example
// Example usage of AddUndo method
var session = new SceneEditorSession();
session.AddUndo(
"Move Object",
() => { /* Code to undo the move operation */ },
() => { /* Code to redo the move operation */ }
);