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.RegisterCreatedObjectUndo

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
public static function RegisterCreatedObjectUndo(objectToUndo: Object, name: string): void;
public static void RegisterCreatedObjectUndo(Object objectToUndo, string name);

Parámetros

objectToUndo The object that was created.
name The name of the action to undo. Think "Undo ...." in the main menu.

Descripción

Register an undo operations for a newly created object.

When the undo is performed the object will be destroyed. All newly created objects that are part of undoable state should be registered with this function.

Note: Object destruction works the same way as it does for Object.Destroy (except for the delay). This means that GameObjects will be destroyed along with all their child GameObjects.


        
// Creates a new game object as an operation that can be undone

using UnityEditor; using UnityEngine;

class CreateGameObjectMenu { [MenuItem ("Example/Create GameObject")] static void CreateGameObject () { // Create GameObject hierarchy. GameObject go = new GameObject ("my GameObject"); GameObject child = new GameObject(); go.transform.position = new Vector3 (5, 5, 5); child.transform.parent = go.transform;

// Register root object for undo. Undo.RegisterCreatedObjectUndo (go, "Create object"); } }