Skip to content

Spine Plugin crashes in HEADLESS mode #4988

@raimon-segura

Description

@raimon-segura

Version

  • Phaser Version: Phaser v3.22.0 (Headless | Web Audio)
  • Operating system: Ubuntu 18.04
  • Browser: Version 79.0.3945.130 (Official Build) (64-bit) & Karma/mocha ChromeHeadless tests

Description

"this.add.text" crashes, seems that code should check the current renderer :

VM53:26911 Uncaught TypeError: Cannot read property 'height' of null
at SpineGameObject.updateSize (:26911:31)
at SpineGameObject.setSkeleton (:26710:21)
at new SpineGameObject (:26390:18)
at GameObjectFactory.add [as spine] (:6666:27)
at Scene.create (eval at (frame.html:45), :33:14)
at SceneManager.create (VM42 3.22.0.js:77900)
at SceneManager.loadComplete (VM42 3.22.0.js:77812)
at LoaderPlugin.emit (VM42 3.22.0.js:1754)
at LoaderPlugin.loadComplete (VM42 3.22.0.js:173994)
at LoaderPlugin.fileProcessComplete (VM42 3.22.0.js:173960)

https://github.com/photonstorm/phaser/blob/v3.22.0/plugins/spine/src/gameobject/SpineGameObject.js#L761
...
var height = renderer.height;
....

Example Test Code

Using this example as a template( https://labs.phaser.io/edit.html?src=src/spine/3.8/basic%20spineboy.js&v=3.22.0 ) :

var config = {
type: Phaser.HEADLESS,
parent: 'phaser-example',
width: 800,
height: 600,
backgroundColor: '#2d2d2d',
scene: {
preload: preload,
create: create,
pack: {
files: [
{ type: 'scenePlugin', key: 'SpinePlugin', url: 'plugins/3.8/SpinePlugin.js', sceneKey: 'spine' }
]
}
}
};

var game = new Phaser.Game(config);

function preload (){
this.load.image('logo', 'assets/sprites/phaser.png');
this.load.setPath('assets/spine/3.8/demos/');
this.load.spine('set1', 'demos.json', [ 'atlas1.atlas' ], true);
}

function create (){
this.add.image(0, 0, 'logo').setOrigin(0);
this.add.spine(400, 600, 'set1.spineboy', 'idle', true);
}

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 SpineAn issue arising from the Spine runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions