From 063a432ec97e30be995aa58334a7b24574a0b146 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Tue, 31 Jul 2018 10:28:36 +0100 Subject: [PATCH] Destroy will now clear out all custom plugins. Fix #3856 --- src/plugins/PluginManager.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/PluginManager.js b/src/plugins/PluginManager.js index 4e2aa5a95..30979e556 100644 --- a/src/plugins/PluginManager.js +++ b/src/plugins/PluginManager.js @@ -804,7 +804,8 @@ var PluginManager = new Class({ /** * Destroys this Plugin Manager and all associated plugins. * 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 * @since 3.8.0 @@ -816,6 +817,13 @@ var PluginManager = new Class({ this.plugins[i].plugin.destroy(); } + PluginCache.destroyCustomPlugins(); + + if (this.game.noReturn) + { + PluginCache.destroyCorePlugins(); + } + this.game = null; this.plugins = []; this.scenePlugins = [];