Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GameObjects stop responding to input events after game recreated with scale.mode #4862

Closed
dranitski opened this issue Nov 16, 2019 · 1 comment

Comments

@dranitski
Copy link

dranitski commented Nov 16, 2019

Version

  • Phaser Version: v3.20.1
  • Operating system: Linux (the issue should not be platform-related)
  • Browser: Version 78.0.3904.87 (Official Build) (64-bit)

Description

GameObjects stop responding to input events after game recreated with scale.mode

Example Test Code

try inserting this code in any Phaser3 Labs example:

const config = {
    type: Phaser.AUTO,
    parent: 'phaser-example',
    scale: {
        mode: Phaser.Scale.RESIZE,
        width: 800, 
        height: 600
    },
    scene: {
        create: create
    }
};

let game = new Phaser.Game(config);

function create ()
{
    this.add.text(10, 10, 'text text text', { font: '16px Courier', fill: '#00ff00' }).setInteractive().on('pointerdown', function () {
        console.log('this.style.color '+this.style.color)
        this.style.color == '#ff0000' ? this.setColor('#00ff00') : this.setColor('#ff0000')
    })

    this.add.text(10, 400, 'destroy game', { font: '16px Courier', fill: '#00ffff' }).setInteractive().on('pointerdown', function () {

        this.sys.game.destroy(true);
        game = new Phaser.Game(config);

    }, this);
}

Steps to reproduce:

  1. click the 'text text text' - it will change color (respond to click events)
  2. click 'destroy game'
  3. click the 'text text text' - it will not change color (not respond to click events)
  4. then change mode: Phaser.Scale.RESIZE to mode: Phaser.Scale.FIT on line 5 or any other (except NONE) - text input will still not work after game destroy
  5. then change mode: Phaser.Scale.RESIZE to mode: Phaser.Scale.NONE on line 5 - text input will work
@photonstorm
Copy link
Collaborator

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.

ce236f0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants