The GameObject destroy event is now emitted at the start of the destroy process, before things like the body or input managers have been removed, so you're able to use the event handler to extract any information you require from the GameObject before it's actually disposed of. Previously, the event was dispatched at the very end of the process.

This commit is contained in:
Richard Davey 2018-03-20 01:05:53 +00:00
parent 8d7ed97d38
commit cb5b12e9d3
2 changed files with 3 additions and 2 deletions

View file

@ -93,6 +93,7 @@ A special mention must go to @orblazer for their outstanding assistance in helpi
* Triangle.getLineA now returns a Line instead of an untyped object. It also now has an optional argument that allows you to pass a Line in to be populated, rather than creating a new one.
* Triangle.getLineB now returns a Line instead of an untyped object. It also now has an optional argument that allows you to pass a Line in to be populated, rather than creating a new one.
* Triangle.getLineC now returns a Line instead of an untyped object. It also now has an optional argument that allows you to pass a Line in to be populated, rather than creating a new one.
* The GameObject `destroy` event is now emitted at the start of the destroy process, before things like the body or input managers have been removed, so you're able to use the event handler to extract any information you require from the GameObject before it's actually disposed of. Previously, the event was dispatched at the very end of the process.

View file

@ -331,6 +331,8 @@ var GameObject = new Class({
this.preDestroy.call(this);
}
this.emit('destroy', this);
var sys = this.scene.sys;
sys.displayList.remove(this);
@ -363,8 +365,6 @@ var GameObject = new Class({
this.scene = undefined;
this.emit('destroy');
this.removeAllListeners();
}