diff options
Diffstat (limited to 'Runtime/BaseClasses/CleanupManager.h')
-rw-r--r-- | Runtime/BaseClasses/CleanupManager.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Runtime/BaseClasses/CleanupManager.h b/Runtime/BaseClasses/CleanupManager.h new file mode 100644 index 0000000..23c76c8 --- /dev/null +++ b/Runtime/BaseClasses/CleanupManager.h @@ -0,0 +1,37 @@ +#pragma once + +#if UNITY_EDITOR + +#include "Runtime/BaseClasses/GameObject.h" + +#include <string> +#include <list> + +class CleanupManager +{ +private: + struct MarkedComponent { + PPtr<Unity::Component> component; + std::string reason; + + bool operator==(PPtr<Unity::Component> const& comp) + { + return this->component == comp; + } + }; + +public: + CleanupManager() {} + + void MarkForDeletion(PPtr<Unity::Component> comp, std::string const& reason); + void Flush(); + + static void DidDestroyObjectNotification (Object* comp, void* userData); + +private: + std::list<struct MarkedComponent> m_markedComponents; +}; + +CleanupManager& GetCleanupManager (); + +#endif
\ No newline at end of file |