Destroy will now clear out all custom plugins. Fix #3856

This commit is contained in:
Richard Davey 2018-07-31 10:28:36 +01:00
parent 75db482ec6
commit 063a432ec9

View file

@ -804,7 +804,8 @@ var PluginManager = new Class({
/** /**
* Destroys this Plugin Manager and all associated plugins. * Destroys this Plugin Manager and all associated plugins.
* It will iterate all plugins found and call their `destroy` methods. * It will iterate all plugins found and call their `destroy` methods.
* Note that the PluginCache is NOT cleared by this as it doesn't hold any plugin instances. *
* The PluginCache will remove all custom plugins.
* *
* @method Phaser.Plugins.PluginManager#destroy * @method Phaser.Plugins.PluginManager#destroy
* @since 3.8.0 * @since 3.8.0
@ -816,6 +817,13 @@ var PluginManager = new Class({
this.plugins[i].plugin.destroy(); this.plugins[i].plugin.destroy();
} }
PluginCache.destroyCustomPlugins();
if (this.game.noReturn)
{
PluginCache.destroyCorePlugins();
}
this.game = null; this.game = null;
this.plugins = []; this.plugins = [];
this.scenePlugins = []; this.scenePlugins = [];