UndoNamespace: UnityEditor
Description

Lets you register undo operations on specific objects you are about to perform changes on.

The Undo system stores delta changes in the undo stack. Undo operations are automatically combined together based on events Eg. mouse down events will split undo groups.

Undo operations store either per property or per object state. This way they scale well with any scene size. The most important operations are outlined below.

Modifying a single property:
        Undo.RecordObject (myGameObject.light, "Set Light Range");
myGameObject.light.range = 5;
Adding a component :
Undo.AddComponent<RigidBody> (myGameObject);
Creating a new game object:
var go = new GameObject ();
Undo.RegisterCreatedObjectUndo (go, "Created go");
Destroying a game object or component:
        Undo.DestroyObjectImmediate (myGameObject);
Changing transform parenting:
        Undo.SetTransformParent (myGameObject.transform, newTransformParent);
Static Functions
ClearUndo Removes aall Undo operation for the identifier object registered using Undo.RegisterCompleteObjectUndo from the undo stack.
CollapseUndoOperations Collapses all undo operation up to group index together into one step.
DestroyObjectImmediate Destroys the object and records an undo operation so that it can be recreated.
GetCurrentGroup Unity automatically groups undo operations by the current group index.
IncrementCurrentGroup Unity automatically groups undo operations by the current group index.
PerformRedo Perform an Redo operation.
PerformUndo Perform an Redo operation.
RecordObject Records any changes done on the object after the RecordObject function.
RecordObjects Records multiple undoable objects in a single call. This is the same as calling Undo.RecordObject multiple times.
RegisterCreatedObjectUndo Register an undo operations for a newly created object.
RevertAllDownToGroup Performs all undo operations up to the group index without storing a redo operation in the process.
RevertAllInCurrentGroup Performs the last undo operation but does not record a redo operation.
SetTransformParent Sets the parent of transform to the new parent and records an undo operation.