Description
The EditLog
method is a virtual method of the GameObject
class in the Sandbox framework. It is used to log edits made to a GameObject
. However, this method is marked as obsolete and should not be used in new code. Instead, developers are advised to use Scene.Editor.UndoScope
or Scene.Editor.AddUndo
for managing undo operations in the editor.
Usage
To log an edit using the EditLog
method, you would typically pass a string representing the name of the edit and an object representing the source of the edit. However, since this method is obsolete, it is recommended to use the newer alternatives provided by the Scene.Editor
class.
Example
// Example of using the obsolete EditLog method
// Note: This is for demonstration purposes only and should not be used in new code.
GameObject myObject = new GameObject();
myObject.EditLog("Change Position", myObject); // Obsolete usage
// Recommended usage
using (var undo = Scene.Editor.UndoScope("Change Position"))
{
// Perform changes here
myObject.Transform.Position = new Vector3(10, 0, 0);
undo.Commit();
}