Undo.RegisterSceneUndo Manual     Reference     Scripting  
Scripting > Editor Classes > Undo

static function RegisterSceneUndo (name : string) : void


name The name of the action to undo. Think "Undo ...." in the main menu.


Register the state of the entire scene so the user can later undo back to that state.

This is the easiest, most robust, but slowest way to store an Undo operation. Call this method before performing an operation that it should be possible to undo.

@MenuItem("GameObject/Delete Camera")
static function Test () {
Undo.RegisterSceneUndo ("Delete Main Camera");
DestroyImmediate (Camera.main.gameObject);

See Also: Undo.RegisterUndo.