Skip to content

Commit

Permalink
fix: entity cache bug (galacean#627)
Browse files Browse the repository at this point in the history
* fix: entity cache bug
  • Loading branch information
GuoLei1990 authored Jan 4, 2022
1 parent 6bdfe26 commit c9b83c9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/src/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ export class Entity extends EngineObject {
* Destroy self.
*/
destroy(): void {
if (this._destroyed) return;

super.destroy();
const abilityArray = this._components;
for (let i = abilityArray.length - 1; i >= 0; i--) {
abilityArray[i].destroy();
Expand Down

0 comments on commit c9b83c9

Please sign in to comment.