UndoSystem UndoSystem { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The UndoSystem property of the SceneEditorSession class provides access to the UndoSystem associated with the current scene editor session. This system is responsible for managing undo and redo operations within the scene editor, allowing developers to revert changes or reapply them as needed.

Usage

To use the UndoSystem property, you must have an instance of SceneEditorSession. Once you have this instance, you can access the UndoSystem to perform undo and redo operations. This is particularly useful when implementing features that require reversible actions, such as editing scene objects or properties.

Example

// Assuming 'session' is an instance of SceneEditorSession
var undoSystem = session.UndoSystem;

// Example usage: Adding an undo action
undoSystem.AddUndo("Move Object", () => MoveObjectBack(), () => MoveObjectForward());

// Example usage: Using an undo scope
using (var scope = session.UndoScope("Batch Operation"))
{
    // Perform multiple operations here
    MoveObject();
    RotateObject();
    // All operations can be undone together
}