GameObject.DomElement still exists after scene sleep
Open
Nobody has claimed this yet.
🖼️ Scene
- Dominant language
- JavaScript
- Stars
- 40.3k
- Forks
- 7.2k
- PR merge metrics
- No merged PRs in 30d
Description
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 ]
})
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the example with Phaser 3.80.1, focusing on the DOM element created with this.add.dom() and the scene.sleep() lifecycle. Trace how scene visibility changes affect ordinary game objects versus GameObject.DomElement; done means the DOM element is no longer visible when its scene sleeps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100