diff --git a/thermion_dart/native/include/components/OverlayComponentManager.hpp b/thermion_dart/native/include/components/OverlayComponentManager.hpp index 60fdaaa2..261c07e3 100644 --- a/thermion_dart/native/include/components/OverlayComponentManager.hpp +++ b/thermion_dart/native/include/components/OverlayComponentManager.hpp @@ -39,6 +39,11 @@ namespace thermion mDepthMaterialInstance = mDepthMaterial->createInstance(); } + ~OverlayComponentManager() { + mEngine->destroy(mDepthMaterialInstance); + mEngine->destroy(mDepthMaterial); + } + void addOverlayComponent(utils::Entity target, filament::MaterialInstance *materialInstance) { auto *color = mRenderTarget->getTexture(filament::RenderTarget::AttachmentPoint::COLOR);