diff --git a/Sources/arm/App.hx b/Sources/arm/App.hx index 15e25f45..af6ddff4 100644 --- a/Sources/arm/App.hx +++ b/Sources/arm/App.hx @@ -319,7 +319,11 @@ class App { } if (UINodes.inst.grid != null) { - UINodes.inst.grid.unload(); + var _grid = UINodes.inst.grid; + function _next() { + _grid.unload(); + } + App.notifyOnNextFrame(_next); UINodes.inst.grid = null; } diff --git a/Sources/arm/data/MaterialSlot.hx b/Sources/arm/data/MaterialSlot.hx index e4008401..9f7e44b4 100644 --- a/Sources/arm/data/MaterialSlot.hx +++ b/Sources/arm/data/MaterialSlot.hx @@ -52,7 +52,10 @@ class MaterialSlot { } public function unload() { - image.unload(); - imageIcon.unload(); + function _next() { + image.unload(); + imageIcon.unload(); + } + App.notifyOnNextFrame(_next); } } diff --git a/Sources/arm/node/MakeMaterial.hx b/Sources/arm/node/MakeMaterial.hx index 9724fba5..7854d92b 100644 --- a/Sources/arm/node/MakeMaterial.hx +++ b/Sources/arm/node/MakeMaterial.hx @@ -230,19 +230,25 @@ class MakeMaterial { static function bakeNodePreviews() { if (Context.nodePreviewsBlur != null) { for (image in Context.nodePreviewsBlur) { - image.unload(); + App.notifyOnNextFrame(function() { + image.unload(); + }); } Context.nodePreviewsBlur = null; } if (Context.nodePreviewsWarp != null) { - for (img in Context.nodePreviewsWarp) { - img.unload(); + for (image in Context.nodePreviewsWarp) { + App.notifyOnNextFrame(function() { + image.unload(); + }); } Context.nodePreviewsWarp = null; } if (Context.nodePreviewsBake != null) { - for (img in Context.nodePreviewsBake) { - img.unload(); + for (image in Context.nodePreviewsBake) { + App.notifyOnNextFrame(function() { + image.unload(); + }); } Context.nodePreviewsBake = null; }