From 5c1947a58999682c4aabf977080b1b4a695737b3 Mon Sep 17 00:00:00 2001 From: MykolaZhura Date: Tue, 7 Mar 2023 10:37:02 +0100 Subject: [PATCH 1/2] remove from engine if children exist on engine --- src/placement.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/placement.ts b/src/placement.ts index e475e64..fd2e21e 100644 --- a/src/placement.ts +++ b/src/placement.ts @@ -196,7 +196,9 @@ export class PlainPlacement extends Entity implements IPlacement { public reset(): void { for (let k in this.children) { - engine.removeEntity(this.children[k]) + if(this.children[k].isAddedToEngine()){ + engine.removeEntity(this.children[k]) + } delete this.children[k] } } From e5281036655c5c9e4ed036dc76f5cef79cb51f6f Mon Sep 17 00:00:00 2001 From: MykolaZhura Date: Tue, 7 Mar 2023 10:38:21 +0100 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a448efe..a89ee3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Remove entity from engine if exist ## [2.0.1] - 2022-11-08 ### Fixed