Description
The UndoSystem
property of the SceneEditorSession
class provides access to the undo system associated with the current scene editor session. This system allows for tracking and managing undo and redo operations within the scene editor, enabling users to revert changes or reapply them as needed.
Usage
To use the UndoSystem
property, you must have an instance of the SceneEditorSession
class. Once you have this instance, you can access the UndoSystem
property to perform undo and redo operations. This is particularly useful when implementing custom editor tools or features that require undo functionality.
Example
// Assuming 'session' is an instance of SceneEditorSession
var undoSystem = session.UndoSystem;
// Example usage: Adding an undo action
undoSystem.AddUndo("Move Object",
() => { /* Code to undo the move */ },
() => { /* Code to redo the move */ });
// Example usage: Using an undo scope
using (var scope = session.UndoScope("Move Object"))
{
// Perform operations that should be undoable
}