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
\$\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

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.