Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

Undo

class in UnityEditor

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual

Descripción

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, e.g. mouse down events will split undo groups. Grouped undo operations will appear and work as a single undo. To control grouping manually use Undo.IncrementCurrentGroup.

By default, the name shown in the UI will be selected from the actions belonging to the group using a hardcoded ordering of the different kinds of actions. To manually set the name, use Undo.SetCurrentGroupName.

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.transform, "Zero Transform Position");
myGameObject.transform.position = Vector3.zero;

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);

Variables Estáticas

undoRedoPerformedCallback that is triggered after an undo or redo was executed.
willFlushUndoRecordInvoked before the Undo system performs a flush.

Funciones Estáticas

AddComponentAdds a component to the game object and registers an undo operation for this action.
ClearUndoRemoves all Undo operations for the identifier object registered using Undo.RegisterCompleteObjectUndo from the undo stack.
CollapseUndoOperationsCollapses all undo operation up to group index together into one step.
DestroyObjectImmediateDestroys the object and records an undo operation so that it can be recreated.
FlushUndoRecordObjectsEnsure objects recorded using RecordObject or RecordObjects are registered as an undoable action.
GetCurrentGroupUnity automatically groups undo operations by the current group index.
GetCurrentGroupNameGet the name that will be shown in the UI for the current undo group.
IncrementCurrentGroupUnity automatically groups undo operations by the current group index.
MoveGameObjectToSceneMove a GameObject from its current scene to a new scene. It is required that the GameObject is at the root of its current scene.
PerformRedoRealizar una operación de rehacer.
PerformUndoRealizar una operación de rehacer.
RecordObjectRecords any changes done on the object after the RecordObject function.
RecordObjectsRecords multiple undoable objects in a single call. This is the same as calling RecordObject multiple times.
RegisterCompleteObjectUndoStores a copy of the object states on the undo stack.
RegisterCreatedObjectUndoRegister an undo operations for a newly created object.
RegisterFullObjectHierarchyUndoCopy the states of a hierarchy of objects onto the undo stack.
RevertAllDownToGroupRealizar una operación de rehacer.
RevertAllInCurrentGroupPerforms the last undo operation but does not record a redo operation.
SetCurrentGroupNameSet the name of the current undo group.
SetTransformParentSets the parent of transform to the new parent and records an undo operation.

Delegados

UndoRedoCallbackDelegate used for undoRedoPerformed.
WillFlushUndoRecordDelegate used for willFlushUndoRecord.