Undo.RegisterUndostatic function RegisterUndo (objectToUndo : Object, name : string) : voidstatic function RegisterUndo (objectsToUndo : Object[], name : string) : voidParameters
DescriptionRegister the state of one or more objects so the user can later undo back to that state.
@MenuItem("GameObject/Set Field of View") static function Test () { Undo.RegisterUndo (Camera.main, "Field of View Change"); Camera.main.fieldOfView = 50; } Note that only the actual objects passed as parameters are saved. For example, passing a game object will not save all its components or child objects. If you need to save the state of an entire game object, you can use EditorUtility.CollectDeepHierarchy on the game object to get all the objects that it contains and pass all those objects as objects to undo. See Also: Undo.RegisterSceneUndo.
|
