Skip to content

[ts][phaser] SpinePlugin incorrect lifecycle for handling of resize events in a scene #2916

@kimdanielarthur-cowlabs

Description

SpinePlugin listens to the Phaser.Scale.Events.RESIZE event in order to udpate the renderer camera on viewport resizes.

Current implementation:

  • event listener added at scene plugin boot()
  • event listener removed on scene shutdown

This breaks with the lifecycle pattern of Phaser scenes where a scene can be started and shutdown multiple times. shutdown may occur for every start.

Reproduction and symptoms;

  1. Load app
  2. scene.start("LevelSceneKey", levelData)
  3. observe resize events render correctly at different sizes
  4. scene.start("LevelSceneKey", level2Data)
  5. observe resizing viewport causes spine rendering to be squashed and aspect ratio incorrect as SpinePlugin viewport is not updated

Suggested fix:

  • Move the removal of event listener to scene destroy instead of shutdown which should represent the same points in life and death of scene

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions