# Communication between scenes

**URL:** <https://phaser.discourse.group/t/communication-between-scenes/12080>\
**Category:** Phaser 3\
**Created:** [July 28, 2022, 8:20pm UTC](https://phaser.discourse.group/t/communication-between-scenes/12080 "2022-07-28T20:20:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thiagobeta](https://avatars.discourse-cdn.com/v4/letter/t/e47774/32.png) [@thiagobeta](https://phaser.discourse.group/u/thiagobeta)\
**Post date:** [July 28, 2022, 8:20pm UTC](https://phaser.discourse.group/t/communication-between-scenes/12080/1 "2022-07-28T20:20:48Z")

</div>

Hello guys,  
I’m trying to send information from the main scene (freezing) to one of menus (when the person levels up to choose skill) and I’m using .emit and .on, but the information appears later (I run it 1x and nothing happens and on the second time the information is updated). I’ve already sent the .emit before and after using cena.launch. can you help me? I created a variable to not pass anything empty.  
code main:

```javascript
 this.scene.launch('menuskill')
            this.events.emit('descSkill1', this.listaDeSkills.razendepelo);
            this.events.emit('descSkill2', this.listaDeSkills.morcego);
            this.scene.pause()
            this.mainScene = this.scene.get('menuskill');
            this.mainScene.events.on('recebeMenu', (a) => {
                this.levelText.setText(a)
            });

```

Menu scene:

```javascript
create(){
        //this.img1 = this.add.image(400 - 100,300,'menuFundo').setInteractive()
        //this.img2 = this.add.image(400 + 100,300,'menuFundo').setInteractive()
        this.skill1 = ''
        this.skill2 = ''
        this.mainScene = this.scene.get('cena001');
        this.mainScene.events.on('descSkill1', (a) => {
            this.skill1 = a
            console.log(this.skill1)
        });
        this.mainScene.events.on('descSkill2', (a) => {
            this.skill2 = a
        });
        this.menu1 = this.add.image(400 - 105,300,'tester').setInteractive()
        this.menu2 = this.add.image(400 + 105,300,'testeb').setInteractive()
        this.menu1.on('pointerdown', function(){
            this.events.emit('recebeMenu', this.skill1);

            this.scene.resume('cena001')
            this.scene.stop('menuskill')
        }, this)
        this.menu2.on('pointerdown', function(){
            this.events.emit('recebeMenu', this.skill1);

            this.scene.resume('cena001')
            this.scene.stop('menuskill')
        }, this)
       
        
    }

```

Thanks.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [July 29, 2022, 3:36pm UTC](https://phaser.discourse.group/t/communication-between-scenes/12080/2 "2022-07-29T15:36:04Z")

</div>

> [@thiagobeta](#):
>
> `this.scene.launch('menuskill')`

I think this is queued so it doesn’t happen immediately, only after the next game step.

---

<div class="post-metadata">

**Author:** ![thiagobeta](https://avatars.discourse-cdn.com/v4/letter/t/e47774/32.png) [@thiagobeta](https://phaser.discourse.group/u/thiagobeta)\
**Post date:** [July 29, 2022, 5:44pm UTC](https://phaser.discourse.group/t/communication-between-scenes/12080/3 "2022-07-29T17:44:46Z")

</div>

I see, how do I pass information to the scene before starting it? Since it’s an auxiliary scene. thanks.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [July 30, 2022, 2:54pm UTC](https://phaser.discourse.group/t/communication-between-scenes/12080/4 "2022-07-30T14:54:20Z")

</div>

One way is the `data` argument, which is passed to scene `init()` and `create()`:

```
this.scene.launch('menuskill', { skill1: a, skill2: b });

```

Or it may be simpler to put some of these values in the game registry:

```
this.registry.set('skill1', a);
// …
const skill1 = this.registry.get('skill1');

```

---

<div class="post-metadata">

**Author:** ![thiagobeta](https://avatars.discourse-cdn.com/v4/letter/t/e47774/32.png) [@thiagobeta](https://phaser.discourse.group/u/thiagobeta)\
**Post date:** [August 1, 2022, 2:28pm UTC](https://phaser.discourse.group/t/communication-between-scenes/12080/5 "2022-08-01T14:28:28Z")

</div>

Nice!  
Thanks!
