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

GameObject.DomElement still exists after scene sleep #6985

Open
jhoryong opened this issue Dec 17, 2024 · 1 comment
Open

GameObject.DomElement still exists after scene sleep #6985

jhoryong opened this issue Dec 17, 2024 · 1 comment

Comments

@jhoryong
Copy link

jhoryong commented Dec 17, 2024

Version

  • Phaser Version: 3.80.1
  • Operating system: Windows

Description

I am using a scene as an inventory window, so it is above another scene.
When I try to hide the scene using scene.sleep(), GameObject.DomElement still remains to be seen after scene's visibility is set to off.
I expected it to disappear, like other gameobjects like image.

Example Test Code

class Test1 extends Phaser.Scene {
constructor() { super('test1')} 
create() {

scene.launch('test2');
}
}

class Test2 extends Phaser.Scene {
constructor() { super('test2')} 
create() {

const text = this.add.dom(0, 0, 'p', {}, 'test');
this.scene.sleep();
// text remains in the screen.
  });
}
}

const game = new Phaser.Game({
    type: Phaser.AUTO,
    width: 800,
    height: 800,
    backgroundColor: '#111111',
    scale: {
        mode: Phaser.Scale.FIT,
        autoCenter: Phaser.Scale.CENTER_BOTH
    },
    scene: [  Test1, Test2  ]
})
@jhoryong jhoryong changed the title GameObject.DomElement still exists after scene's visibility set to off GameObject.DomElement still exists after scene sleep Dec 18, 2024
@samme
Copy link
Contributor

samme commented Dec 19, 2024

Works for me: https://phaser.io/sandbox/cyBjdyjq

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

No branches or pull requests

2 participants