-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
Version
- Phaser Version: 3.86.0 and Spine 4.1
- Operating system: Windows
- Browser: Chrome, Edge, Firefox
Description
If you add a Spine game object to a scene, and then destroy it, go to another scene, and then try to add a different Spine game object ("different" in this case means a different key) to the scene, the texture that is used for the Spine will flash on the screen for a frame. I'm guessing there's a binding issue somewhere.
Example Test Code
The following code will demonstrate the issue:
export default class TestScene1 extends Phaser.Scene {
create() {
this.cameras.main.setBackgroundColor(0xffffff);
this.testSpine = this.add.spine(500,500, "spine0");
this.time.delayedCall(5000, ()=>
{
this.testSpine.destroy();
this.scene.start("Test2");
});
}
}
export default class TestScene2 extends Phaser.Scene {
create() {
this.cameras.main.setBackgroundColor(0xffffff);
this.testSpine = this.add.spine(500,500, "spine1");
}
}
Note that the Spines used in the 2 different scenes must be different ones, if you use the same key for both, the issue does not happen. Other ways to prevent it from happening:
- If you add the TestScene1 Spine again in TestScene2 FIRST, when you add the other Spine, the issue won't happen.
- If you don't call
.destroy()on the Spine game object in TestScene1, the issue won't happen in TestScene2.
There are probably other ways to prevent it from happening. I tried a few different sets of our Spine objects and it's happening no matter what I use, but it's possible there is something in our Spines that causes the issue.
Additional Information
I wasn't able to test using Spine 3.8.