I have a user widget that simply shows a characters name as text, and a health bar with a progress bar:
In C++, I am dynamically creating this widget based on the number of characters in my level. I add them into a scale box on the HUD. This is what it looks like after the c++ code runs:
The problem is that my widget I’m creating dynamically, is not filling out the scalebox I am placing it in in the HUD. It only fills out as much as it needs to display the characters name. In my HUD blueprint, if I manually place the party frames (user widget containing name + health bar), as I did in the above image, each party frame has a horizontal and vertical alignment option. In the BP I can manually set these to fill, and they fill the entire scalebox like this:
How can I achieve this in c++? The set horizontal and vertical alignment functions do not exist for user widgets, but they show up when I create an instance of them in blueprint. It seems that the widget automatically defaults to “center” horizontal and vertical alignments which causes the widget to not fill the entire space.
What can I do in C++ to force the horizontal and vertical alignment after I create my widgets? Or is there a way I can change my user widget so the text uses the entire space instead of only what is required? I can’t set the text to size: fill, because then it share half the space with the progress bar. Any options on how to get the sizing I need?
Thanks!