Hi Guys. I trying to remove all child entity, but it has a problem.
If you watch the video, only a few items are deleted.
my algorithm is.
- Remove all child entity under parent entity.
- Add new children in parent entity.
my code is.
if(contentView.children.length > 0) {
contentView.children.forEach((e) => {
console.log(contentView.children.length);
e.destroy();
});
}
if(this.itemData != null && contentView.children.length === 0) {
var controller = this.storeControllerEntity;
for (var idx = 0; idx < this.itemData.length; idx++) {
controller.script.storeController._onAddStoreItem(this.itemData[idx].name, this.itemData[idx].price, this.itemData[idx].icon);
}
}
Please, Give me tips or links or answers.