0
\$\begingroup\$

I want to set a background color for my game.

I found this solution:

function create() {
  this.cameras.main.setBackgroundColor("#d5d5d5");
}

but I want to be sure that there is not a more standard way to do this, because editing the camera's property means that the background would be different for another camera.

Thank you for your help.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

You can set the backgroundColor property of the GameConfig when you create a new Phaser.Game.

const config = {
   // ...
   backgroundColor: '#d5d5d'
}

const game = new Phaser.Game(config)

Phaser docs for more info: https://photonstorm.github.io/phaser3-docs/Phaser.Types.Core.html#.GameConfig

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .