Undo Class  

Scripting > Editor Classes > Undo

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

Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.

Class Functions
RegisterUndo

RegisterSceneUndo

Undo by saving the entire scene

ClearUndo

PerformUndo

Perform an Undo operation.

PerformRedo

Perform an Redo operation.

MakeSnapshot

Make a snapshot of objects in a temporary buffer.

SaveSnapshot

Save the snapshot made with MakeSnapshot to the undo buffer.

RestoreSnapshot

Restore the state of all snapshot objects to their state when MakeSnapshot was called.