# GameObject.Container in container doesn't call addedToScene event

**URL:** <https://phaser.discourse.group/t/gameobject-container-in-container-doesnt-call-addedtoscene-event/11530>\
**Category:** Phaser 3\
**Created:** [April 14, 2022, 3:01pm UTC](https://phaser.discourse.group/t/gameobject-container-in-container-doesnt-call-addedtoscene-event/11530 "2022-04-14T15:01:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenoitFreslon](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/benoitfreslon/32/6128_2.png) [@BenoitFreslon](https://phaser.discourse.group/u/BenoitFreslon)\
**Post date:** [April 14, 2022, 3:01pm UTC](https://phaser.discourse.group/t/gameobject-container-in-container-doesnt-call-addedtoscene-event/11530/1 "2022-04-14T15:01:28Z")

</div>

Hello,

I found that if I add a GameObject.Container in a container the addedToScene event is not called.

It worked when I added the game object  
in the scene with this.scene.add()  
in a layer this.layer1.add(),  
but not in the container with this.container1.add();

Is it a normal behavior?

EDIT : The event addedToScene is called when the scene changes… So weird.

Best,

---

<div class="post-metadata">

**Author:** ![BenoitFreslon](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/benoitfreslon/32/6128_2.png) [@BenoitFreslon](https://phaser.discourse.group/u/BenoitFreslon)\
**Post date:** [April 19, 2022, 12:14pm UTC](https://phaser.discourse.group/t/gameobject-container-in-container-doesnt-call-addedtoscene-event/11530/2 "2022-04-19T12:14:11Z")

</div>

Example here :

> <https://github.com/photonstorm/phaser/issues/6078>
>
> \## Version
> In Phaser 3 example
> 
> \## Browser
> \* Browser: Chrome, Safari
> 
> 
> \##… Description
> 
> Hello
> 
> Test this code, tap T to remove the scene and see that the container2.addedToScene event is called when the scene is removed.
> 
> 
> 
> \## Example Test Code
> 
> \`\`\`
> class ContainerTest extends Phaser.GameObjects.Container {
> constructor(scene, x, y) {
> super(scene, 166, 275);
> console.log("container:constructor");
> }
> 
> addedToScene() {
> super.addedToScene()
> console.log("container:addedToScene");
> }
> }
> 
> var config = {
> type: Phaser.AUTO,
> width: 800,
> height: 600,
> backgroundColor: '#010101',
> parent: 'phaser-example',
> scene: {
> preload: preload,
> create: create
> }
> };
> 
> var game = new Phaser.Game(config);
> 
> function preload ()
> {
> 
> }
> 
> function create ()
> {
> console.log("create");
> 
> container = this.add.container(400, 300);
> 
> container2 = new ContainerTest(this, 100, 100);
> container.add(container2);
> 
> this.input.keyboard.on("keyup-T", () =\> {
> console.log("Input detected")
> this.scene.remove();
> })
> }
> 
> \`\`\`
