phaser
phaser copied to clipboard
inactive scene is updated after transition complete
Version
- Phaser Version:
3.52.0 - Operating system:
ubuntu 18.04 - Browser:
chrome
Description
Hi,
I tried to use scene Transition and I found inactive scene was updated after shutdown (only once).
I’m not familiar with Phaser, system.sceneUpdate.call seems to be called after scenePlugin.transitionComplete.
// Scene.System
step: function (time, delta)
{
var events = this.events;
events.emit(Events.PRE_UPDATE, time, delta);
// 'scenePlugin.transitionComplete' is called and scene will be inactive
events.emit(Events.UPDATE, time, delta);
// update inactive scene
this.sceneUpdate.call(this.scene, time, delta);
events.emit(Events.POST_UPDATE, time, delta);
},
Example Test Code
Transition was started as following…
// from : scene.system.settings{active: true, status: 5 ...}
// to : scene.system.settings{active: false, status: 1 ...}
this.scene.transition({
target: 'anotherScene',
duration: 2000,
remove: false,
allowInput: false,
onUpdate: (progress: number]) => {
console.log(`transition: ${progress}`);
}
});
This issue has been mentioned on Phaser. There might be relevant details there:
https://phaser.discourse.group/t/inactive-scene-is-updated-after-transition-complete/8850/3
Scene POST_UPDATE also fires once after transition completes as well.
Here is an example of both: https://codepen.io/samme/pen/ExNgKLY. Click to start transition, wait for transition to complete, then see failed assertions in console.
I made a fix but it's a little weird: https://github.com/samme/phaser/commit/4f02236fcdbd4f5ade03b9960f8c3da336b47c68
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.