public static void DisableUndoPro () { enabled = false; // Unsubscribe from every event Undo.undoRedoPerformed -= UndoRedoPerformed; EditorApplication.update -= Update; // Discard now unused objects dummyObject = null; getRecordsInternalDelegate = null; records = null; }
private static void CreateRecords () { #if UNDO_DEBUG Debug.Log ("Creating scene undo records!"); #endif if (records != null) UnityEngine.Object.DestroyImmediate (records.gameObject); GameObject recordsGO = new GameObject ("UndoProRecords"); #if !UNDO_DEBUG recordsGO.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector; #endif records = recordsGO.AddComponent<UndoProRecords> (); }
public static void DisableUndoPro() { enabled = false; // Unsubscribe from every event Undo.undoRedoPerformed -= UndoRedoPerformed; EditorApplication.update -= Update; #if UNITY_2017_2_OR_NEWER EditorApplication.playModeStateChanged -= PlayModeStateChanged; #else EditorApplication.playmodeStateChanged -= PlaymodeStateChanged; #endif // Discard now unused objects dummyObject = null; getRecordsInternalDelegate = null; records = null; }
private static void AssureRecords () { if (records == null) { records = GameObject.FindObjectOfType<UndoProRecords> (); if (records == null) CreateRecords (); #if UNDO_DEBUG else Debug.Log ("Found undo records in scene!"); #endif } if (records.undoState == null) { #if UNDO_DEBUG Debug.Log ("UndoState recreated!"); #endif records.undoState = FetchUndoState (); } }