phaser
phaser copied to clipboard
scene plugin install failure
Version
- Phaser Version: 3.80.1
- Operating system: windows 10
- Browser: chrome
Description
i found an issue with phaser.js . it was a issue loading some plugins. as an example the animated tiles plugin would not load properly because if line 126250 " pluginManager.installScenePlugin(systemKey, window[this.key], sceneKey, this.loader.scene, true);". if this line is change to "pluginManager.installScenePlugin(systemKey, Function(return ${this.key}
)(), sceneKey, this.loader.scene, true);" then the plugin works correctly.
the script this resides in is here : https://github.com/phaserjs/phaser/blob/e337b6e4d13eb1979af06fe1ccf001b5174f0a47/src/loader/filetypes/PluginFile.js#L114
Example Test Code
code can be found at the text links below.
Additional Information
here is the plugin that was having trouble working. https://phaser.discourse.group/t/phaser-3-5-animated-tiles-tiled/11148
What's the code you used when the animated tiles plugin wouldn't load properly?
the code I was using the animated tile plugin was my own game project. specifically my default scene class which is a class that builds of the scene object. specifically it was this.load.scenePlugin({ key: 'AnimatedTiles', url: 'lib/vendors/AnimatedTiles.js', sceneKey: 'AnimatedTiles' });
load.scenePlugin()
only works if the key
is a property of window
after the plugin script loads. The plugin author has to write it that way, e.g.,
window.AnimatedTiles = AnimatedTiles;
You can instead load the plugin script as a <script>
(or even import it) and then pass the plugin class to the game config.
thank you for the suggestion, i will give that a try.