Description
The EditLog
method is part of the Component
class in the Sandbox API. This method is marked as obsolete and should not be used in new code. It was originally intended to be called when something on the component has been edited. Instead, developers are advised to use Scene.Editor.UndoScope
or Scene.Editor.AddUndo
for handling undo operations related to component edits.
Usage
Since EditLog
is obsolete, it is recommended to avoid using it in your code. Instead, use the recommended alternatives:
Scene.Editor.UndoScope
: Use this to create a scope for undo operations, which automatically handles undo/redo actions.
Scene.Editor.AddUndo
: Use this to manually add an undo action to the editor's undo stack.
Example
// Example of using the recommended alternative
using Sandbox;
public class MyComponent : Component
{
public void EditSomething()
{
// Instead of using EditLog, use Scene.Editor.UndoScope
using (var undo = new Scene.Editor.UndoScope("Edit Something"))
{
// Perform your edit operations here
// ...
// Mark the operation as complete
undo.Complete();
}
}
}