These archived docs are for Phaser 2.4.3 Phaser 3 docs can be found on
Phaser CE docs can be found on the Phaser CE Documentation site.


Phaser.Component. Destroy

new Destroy()

The Destroy component is responsible for destroying a Game Object.

Source code: gameobjects/components/Destroy.js (Line 12)

Public Properties

[readonly] destroyPhase : boolean

As a Game Object runs through its destroy method this flag is set to true, and can be checked in any sub-systems or plugins it is being destroyed from.

Source code: gameobjects/components/Destroy.js (Line 22)

Public Methods


Destroys the Game Object. This removes it from its parent group, destroys the input, event and animation handlers if present and nulls its reference to game, freeing it up for garbage collection.

If this Game Object has the Events component it will also dispatch the onDestroy event.

Name Type Argument Default Description
destroyChildren boolean <optional>

Should every child of this object have its destroy method called as well?

Source code: gameobjects/components/Destroy.js (Line 33)