[UMG] Arrangement of the children in Horizontal box

I’m trying to create dynamic UI panel with custom number of buttons based on player choice. My problem is, that i want to be able arrange this buttons right-to-left and i need them to be wrapped by a Horizontal box. Horizontal box arrange its children left-to-right by default and i found the only way to achieve that - by setting scale X=(-1).

Unfortunately, if i do it this way, when i zoom in or scale the box children will start to disappear based on their unscaled position(illustrated on image).

If anyone suggest solution to this or different approach to arrange my widgets, i would be grateful.

5 Likes

Hi, have you gotten this to work properly yet? I’m trying to accomplish something similar

Nope, still stuck…

sigh, sad to here…
might be better off writing my own layout-er using a canvas panel =S

This actualy works! It is not exactly what i needed but it’s as close, as it can get, so thanks.

Hey, just figured this out:

Add a Spacer to each end of your horizontal box, set your widgets to auto, and your spacers to fill

Make sure your horizontal box is NOT set to “size to content”

That will center your widgets, if you want to have everything aligned right to left, just delete the left spacer

Hopefully this does the trick for you!

11 Likes

Why not reverse the order in which you add things to the horizontal box instead?

Deleting the left spacer didn’t work for me, yet setting the right spacer fill-percentage value to a tiny value did. Even better, I found out you can even set it to zero and it’ll work perfectly with no offset added as you add more widgets/images to the horizontal box. I wouldn’t have figured that out without @maxxburman’s findings though, so all credits to him. Thank you!

Arrange children horizontally in UMG Horizontal Box