Example #1
0
		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;
		}
Example #2
0
		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> ();
		}
Example #3
0
        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;
        }
Example #4
0
		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 ();
			}
		}