UMG [Wrap Box] Aligning Child Content

Hey Epic,

Quick question about the Wrap Box panel in UMG. I’m adding child Text widgets to a Wrap Box, and I’d like them to align in the center of the Wrap Box. It seems like Wrap Box only supports children arranged from left to right. I’ve been unable to figure out a way to change this behavior. Am I missing something, or is this a limitation of Wrap Box? I’d like to use it as it seems far easier than using a series of nested vertical and horizontal slots.

Thanks!

I’m also trying to achieve this. I am doing something similar to the original “Tony Hawk” combo display at the bottom of the screen (crazy move 1 + crazy move 2 + crazy move 3) kinda thing. Every time they do a move I’d like to add a " + " and “new move” to the list, and keep it centered at the bottom of the screen.

I can put a single text block into a wrap box and center it by setting it to align center + “fill empty space”, but the moment you add a second text block with the same settings, the first text block goes hard to the left while the new one is centered in the remaining space on that line.

I can achieve it with a horizontal box, but at some point I need it to spill over onto a new line like a wrapbox does. So the current planned workaround is to stick a horizontal box inside a wrap box, then when i’m adding a new text block I’ll check the length of the text block (in blueprint) against a set “max line length” (scaled by resolution) and if it exceeds it, add another horizontal box to the wrapbox and stick the whole text box in there. Though this does seem eerily familiar to the manual wrapping I was doing in canvas in UDK, urgh.

I have same issue, wow… I can’t belive it is not implemented

I’m not sure if it’ll ever be seen, but I’ve added a feature request: https://answers.unrealengine.com/questions/423495/feature-request-umg-wrapbox-leftcentreright-alignm.html

As a quick solution (it requires C++ though), I’ve copied the UE4 WrapBox widget and made a few minor additions to add the alignment feature.

Download this zip and extract it to your game’s source directory. After compiling there should be a new Aligned Wrap Box entry in the UMG palette, and a Horizontal Alignment property in the widget’s details panel.

I can’t make any guarantees, but so far it has worked for me.

thank you

Is anyone able to turn this into a plugin?

Heya, I found a solution here. If I wrap my non-centre-aligning content in a size box which matches the other elements, I can then align the text inside the size box to centre-vertical.

Hope this helps those who had similar issues.

This works, thanks alot!

Silly workaround solution I found, but it works. Under transform for the Wrap Box, make the X Scale negative, ie: (-1,1), and then for each child widget also set the X scale to be negative. This way, the WrapBox is flipped horizontally, making it’s children stack right to left, and then the children are flipped back to negate the “mirror” effect this would have.

3 Likes

Can you reupload it or post the link again? It seems to be broken…