title: How can I pass data from a scene to another in Phaser 3?
body: <p>I'm creating a "space invaders" kinda of game and I'm really having problems with passing score from my WorldScene to my GameOverScene.</p>
  
  <p>I already tried to use init: function() to pass data but I'm probably doing something wrong...</p>
  
  <p>I'm using Phaser 3.</p>
  
  <p>A little of my WorldScene:</p>
  
  <pre><code>
      constructor() {
          super( { key: 'WorldScene'} );
      }
  
      preload()
      {
  
      }
      create()
      {
  
          var score = 0;
   (...)
  </code></pre>
  
  <pre><code>            //a scene comeca de novo
              //this.scene.restart();
              this.scene.start('GameOverScene', {score_n: this.score} );
            }, [], this);
  </code></pre>
  
  <p>And my GameOverScene in game.js</p>
  
  <pre><code>
    Extends: Phaser.Scene,
  
    initialize:
  
    function GameOverScene ()
    {
        Phaser.Scene.call(this, { key: 'GameOverScene' });
  
    },
  
    init: function (data)
      {
          console.log('init', data);
          this.scoreFinal = data.score_n;
      },
  
    preload: function ()
    {
      //background inicial
      this.load.image('back_menu', 'assets/img_espaco.png');
    },
  
    create: function (data)
    {
  
      let backg = this.add.sprite(0, 0, 'back_menu');
          backg.setOrigin(0, 0);
  
         //texto do game over
          gameOver_text = this.add.text(320, 150, 'Game Over', { fontSize: '70px', fill: '#FF0000' });
          gameOver_text.setOrigin(0.5);
  
          //score
          scoreFinal_txt = this.add.text(320, 210, 'Pontuação Final: '+ this.scoreFinal, { fontSize: '20px', fill: '#FFF' });
          scoreFinal_txt.setOrigin(0.5);
  
          //botao de recomeçar
          bt_novo = this.add.text(320, 260, 'Voltar ao Inicio', { fontSize: '30px', color: '#ffffff' }).setInteractive();
          bt_novo.setOrigin(0.5);
  
          //se o botao for carregado começa o jogo
          bt_novo.on('pointerdown', function (event) { this.scene.start('MenuScene'); }, this );
          bt_novo.on('pointerover', function (event) { bt_novo.setStyle({ fill: '#ff0'}); } )
          bt_novo.on('pointerout', function (event) { bt_novo.setStyle({ fill: '#ffffff'}); } )
  
  
    },
  
  }); ```
  
  
  My scoreFinal_txt shows: "Pontuaçao Final: undefined"
  </code></pre>