Textblock can't be aligned correctly

Hi I copy gui alignment code, and play around with it. Found that I couldn’t place TextBlock to the top. Here is the playground: https://playground.babylonjs.com/#XCPP9Y#16885. Please see Line 54 & Line 59. Thanks

Hello! That’s because as the TextBlock width and height weren’t defined, they default to “100%”, so they occupy all the space in the GUI:

You can solve this by either setting a width/height, or setting resizeToFit as true:

A third alternative would be to leave the textBlock occupying all the space and use textVerticalAlignment instead:

Simple GUI in fullscreen mode | Babylon.js Playground (babylonjs.com)

3 Likes

Got it. Thanks for help

1 Like