From 415997cd1d9cbaa00c52cce312d80cdf16273a6b Mon Sep 17 00:00:00 2001 From: Thomas Gorisse Date: Tue, 5 Sep 2023 10:53:02 +0200 Subject: [PATCH] Fixed Node destroy --- .../src/main/java/io/github/sceneview/managers/NodeManager.kt | 2 +- sceneview_1_0_0/src/main/java/io/github/sceneview/nodes/Node.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sceneview_1_0_0/src/main/java/io/github/sceneview/managers/NodeManager.kt b/sceneview_1_0_0/src/main/java/io/github/sceneview/managers/NodeManager.kt index 48230fb2..5bd133c3 100644 --- a/sceneview_1_0_0/src/main/java/io/github/sceneview/managers/NodeManager.kt +++ b/sceneview_1_0_0/src/main/java/io/github/sceneview/managers/NodeManager.kt @@ -37,7 +37,7 @@ class NodeManager(val engine: Engine) { } fun destroy() { - entities.forEach { entity -> + entities.toList().forEach { entity -> destroyNode(entity) } entities.clear() diff --git a/sceneview_1_0_0/src/main/java/io/github/sceneview/nodes/Node.kt b/sceneview_1_0_0/src/main/java/io/github/sceneview/nodes/Node.kt index 841e4ffe..c046d28a 100644 --- a/sceneview_1_0_0/src/main/java/io/github/sceneview/nodes/Node.kt +++ b/sceneview_1_0_0/src/main/java/io/github/sceneview/nodes/Node.kt @@ -259,7 +259,7 @@ open class Node( } open fun destroy() { - childNodes.forEach { + childNodes.toList().forEach { removeChildNode(it) it.destroy() }