fix: children splicing
This commit is contained in:
parent
ecee85dac8
commit
cfd6a5ef67
|
@ -70,8 +70,10 @@ export class Spawner extends decorate(Trait) {
|
|||
return {
|
||||
|
||||
killAllChildren: () => {
|
||||
for (let i = 0; i < this.children.length; i++) {
|
||||
this.children[i].destroyGently();
|
||||
// Juggle children since this may cause splices and mess up the array.
|
||||
const children = this.children.slice(0);
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
children[i].destroyGently();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user