Pool (group) of SpineGameObject, correct reference to Phaser Spine Plugin?

Hi all,

I’m trying to create a pool of spine objects, like this example with Images:
http://labs.phaser.io/edit.html?src=src/pools/bullets.js

my Enemy class:

var Enemy = new Phaser.Class({
    Extends: SpinePlugin.SpineGameObject,

    initialize:

    function Enemy (scene)
    {
        SpinePlugin.SpineGameObject.call(this, scene, REFERENCE_SPINE_PLUGIN, 0, 0, 'skeleton', 'animation', true);

    }

   ...
}

how to send the parameter REFERENCE_SPINE_PLUGIN correctly?
I tried to call: "Spine" / "spine" / "SpinePlugin" / scene.sys['Spine'] / scene.sys['SpinePlugin']
but without success.

config of Phaser.Game

...
plugins: {
	scene: [
		{
			key: 'SpinePlugin',
			plugin: window.SpinePlugin,
			sceneKey: 'spine'
		}
	]
},
...

https://phaser.io/examples/v3/view/spine/extended-class

I did via CustomSpineObject1 example class and got the error:
Uncaught TypeError: o.addToDisplayList is not a function

I’m agree that possible to create via Containers, but that’s not best idea, because of performance. Ideally to extend SpineGameObject class.

Hey there,

I don’t know if I get the problem right, but the plugin in your initial code has the Mapping spine, so in a scene you would reference the plugin with this.spine or in another context, where scene is a SceneObject: scene.spine.

Best regards
Nick

Yes, if add Spine Plugin in Game class directly, instead of adding in game config it will work fine:

    constructor() {
        super({
            key: 'Game',
            pack: {
                files: [
                    { type: 'scenePlugin', key: 'SpinePlugin', url: 'js/SpinePlugin.min.js', sceneKey: 'spine' }
                ]
            }
        });
    }

but @rich doesn’t recommend using Spine in Group.instead of that better to write own pool for that.