Is there any way to adjust widget components size through blueprints?

I’m trying to create an inventory menu that adjusts its number of rows and columns dynamically in game based on 2 variables: rows, columns.
I’ve searched everywhere and i cannot find an answer. Is there any way to do this with blueprints?

The easiest way to do this would be to use a uniform grid panel.

In row and in column are the position of the element.

If a grid widget is not desired a SizeBox might be what you want.

Size Box | Unreal Engine 5.2 Documentation

Usually an inventory has a fixed sized grid (say 5 colums and X rows) in which the unused columns are filled with nothing. This helps with icon scaling. You can wrap such a grid too in a size + scale box to assist with inner and outer sizing.

Thanks for jumping in, guys.
I tried Uniform Grid by trying to add an Image 5 times through a loop, using Add Child to Uniform Grid, after Event OnInitialized in the widget graph (I’m then creating and adding the widget to viewport in FP_Character blueprint).
But for some reason I only get 1 image on screen instead of 5. And it looks like it’s positioned where the last entry would be.
I have a print string that shows me the code is running 5 times and spits out 5 different values from the index in the For Loop (which I connect to the Row and Column of the AddChild node).
Don’t know what I’m doing wrong here.

You’re likely adding the same thing every time. You need to have 5 different image objects- they can have the same properties (meaning they’ll look like the same object to the user).

How you probably have it set up now:

How you should have it set up:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.