修复实体销毁的时候,也会销毁子实体,但是销毁子实体的时候并没有removeChild。导致了这个实体再次被使用时,_children还留存着之前子实体的引用,但是这个子实体已经被销毁,而导致的报错

This commit is contained in:
dgflash
2023-05-25 09:25:38 +08:00
parent 83e809733b
commit 7642edfe97

View File

@@ -267,6 +267,7 @@ export class ECSEntity {
destroy() {
if (this._children) {
this._children.forEach(e => {
this.removeChild(e);
e.destroy();
});
}