Skip to content

Commit d1cc126

Browse files
committed
If a GameObject has a preDestroy method then call it before running the standard destroy calls.
1 parent 3964c7a commit d1cc126

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

v3/src/gameobjects/GameObject.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ var GameObject = new Class({
244244
*/
245245
destroy: function ()
246246
{
247+
if (this.preDestroy)
248+
{
249+
this.preDestroy();
250+
}
251+
247252
this.scene.sys.displayList.remove(this);
248253
this.scene.sys.updateList.remove(this);
249254

0 commit comments

Comments
 (0)