mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 14:40:38 +00:00
Sprites now have preDestroy
method, which is called automatically by destroy
. The method destroys the Animation component, unregistering the remove
event in the process and freeing-up resources. Fix #4051
This commit is contained in:
parent
e94d92518d
commit
2812bff0ee
2 changed files with 15 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
### Bug Fixes
|
||||
|
||||
* GameObjects added to and removed from Containers no longer listen for the `shutdown` event at all (thanks Vitali)
|
||||
* Sprites now have `preDestroy` method, which is called automatically by `destroy`. The method destroys the Animation component, unregistering the `remove` event in the process and freeing-up resources. Fix #4051 (thanks @Aveyder)
|
||||
|
||||
### Examples, Documentation and TypeScript
|
||||
|
||||
|
|
|
@ -153,6 +153,20 @@ var Sprite = new Class({
|
|||
// Extra Sprite data is added here
|
||||
|
||||
return data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles the pre-destroy step for the Sprite, which removes the Animation component.
|
||||
*
|
||||
* @method Phaser.GameObjects.Sprite#preDestroy
|
||||
* @private
|
||||
* @since 3.14.0
|
||||
*/
|
||||
preDestroy: function ()
|
||||
{
|
||||
this.anims.destroy();
|
||||
|
||||
this.anims = undefined;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue