修复CCEntity释放时报错问题

This commit is contained in:
dgflash
2025-09-19 17:49:52 +08:00
parent dcd1ef8340
commit 21472de6bc

View File

@@ -170,9 +170,16 @@ export abstract class CCEntity extends ecs.Entity {
//#endregion
destroy(): void {
this.singletons.clear();
this.businesss.forEach(business => business.destroy());
this.businesss.clear();
if (this.singletons) {
this.singletons.clear();
this.singletons = null!;
}
if (this.businesss) {
this.businesss.forEach(business => business.destroy());
this.businesss.clear();
this.businesss = null!;
}
super.destroy();
}
}