fix: destroy guard
This commit is contained in:
parent
877541f6ce
commit
2747542932
|
@ -23,6 +23,7 @@ export class Existent extends decorate(Trait) {
|
|||
|
||||
constructor(entity, params, state) {
|
||||
super(entity, params, state);
|
||||
this._isDestroying = false;
|
||||
this._isTicking = this.params.isTicking;
|
||||
}
|
||||
|
||||
|
@ -30,6 +31,10 @@ export class Existent extends decorate(Trait) {
|
|||
return {
|
||||
|
||||
destroy: () => {
|
||||
if (this._isDestroying) {
|
||||
return;
|
||||
}
|
||||
this._isDestroying = true;
|
||||
this.entity.isTicking = false;
|
||||
this.entity.emit('destroy');
|
||||
this.entity.emit('destroyed');
|
||||
|
|
Loading…
Reference in New Issue
Block a user