private void OnDisable()
        {
            _helper.ShutDown();
            _editorData = _helper.EditorData;

            Undo.undoRedoPerformed -= UndoRedoEvent;
        }
 private void OnEnable()
 {
     _helper.Init();
     // Set _editorData to new instance, so it does not conflict with undo redo inside the PoissonHelper
     // PlacedObjects and other vars were being resetted
     _editorData             = null;
     Undo.undoRedoPerformed += UndoRedoEvent;
 }
 public static void CleanupPlacedObjects(PoissonInternalEditorData editorData, int start)
 {
     for (int i = start; i <= editorData.PlacedObjects.Count - 1; ++i)
     {
         foreach (GameObject gameObject in editorData.PlacedObjects[i])
         {
             if (gameObject)
             {
                 PoissonPlacer placer = gameObject.GetComponent <PoissonPlacer>();
                 if (placer != null)
                 {
                     PoissonHelperInternalStorage.Instance.Remove(placer);
                     CleanupPlacedObjects(placer.EditorData, 0);
                     placer.EditorData.DestroyVisual(placer.ModeData);
                 }
                 Object.DestroyImmediate(gameObject);
             }
         }
         editorData.PlacedObjects[i].Clear();
     }
 }