theWaver Posted September 13, 2021 Share Posted September 13, 2021 Phaser 3.55.2 I have a Phaser.GameObject.Text object. When I initialize it, I pass a `fixedHeight` value in the config. I would like the text to be vertically centered within this height. I am aware that I can use origin to center the text given a specific point, but this is not about centering the text inside its container, but rather center it "within itself". If you're wondering why I'm doing it this way: to leverage the Text object's `backgroundColor` prop, and avoid creating an additional object just to paint the Text's background. Link to comment Share on other sites More sharing options...
stevium Posted June 10, 2022 Share Posted June 10, 2022 Not sure if there is a way of specifying vertical alignment, but I have managed to workaround it by using: text.setPadding(left, top, right bottom) Link to comment Share on other sites More sharing options...
Recommended Posts