Skip to content

Container created with the GameObjectCreator does not show all children. #6743

@Fake

Description

@Fake

Version

  • Phaser Version: 3.70.0
  • Operating system: Any
  • Browser:

Description

When you create a container with GameObjectCreator, only one of the children is displayed. Creating with GameObjectFactory works fine.

Example Test Code

class TestScene extends Phaser.Scene {
  create() {
    // does not show all children
    this.make.container({
      x: 10, y: 50,
      children: [
        this.make.text({
          text: "qwer",
          x: 50,
        }, false),
        this.make.text({
          text: "asdf",
          x: 100,
        }, false),
        this.make.text({
          text: "zxcv",
          x: 150,
        }, false),
      ]
    }, true)

    // this works fine
    this.add.container(10, 100, [
      this.make.text({
        text: "qwer",
        x: 50,
      }, false),
      this.make.text({
        text: "asdf",
        x: 100,
      }, false),
      this.make.text({
        text: "zxcv",
        x: 150,
      }, false),
    ])

    // this also works fine
    const container = this.make.container({
      x: 10, y: 150,
      children: [],
    }, false)
    container.add(this.make.text({
      text: "qewr",
      x: 50,
    }, false))
    container.add(this.make.text({
      text: "asdf",
      x: 100,
    }, false))
    container.add(this.make.text({
      text: "zxcv",
      x: 150,
    }, false))
    this.add.existing(container)
  }
}

new Phaser.Game({
  type: Phaser.AUTO,
  width: 320,
  height: 240,
  scene: new TestScene(),
})

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions