How can I perfectly fit buttons inside of a frame using a UIGridLayout

How can I fit buttons inside of a frame without having blank spaces on the end?

How it looks:

How I would like it to look:

Not sure if this is fit manually through trial and error and changing the size of the button over and over again until it fits into the frame or if this is done automatically. I know next to nothing about UI objects so help would be greatly appreciated!

you can try using dynamic UI where you take the measurement of a single icon and calculate the exact frame size you need.

It takes a lot of work, but it is worth it. :slight_smile:

1 Like

Can you give me any hints on what calculations I need to use?

if you know the size of your icon is 45px wide and you need 4 of those icon across.

You can say 45 x 4 = 180px wide. (if you don’t use spaces in between)

1 Like

Ohhh I see, I’ll try it out :smile:

Hello,
Do the following steps to align your buttons to the center:

  • Go to Properties in the UIGridLayout.
  • Make the HorizontalAlignment to the Center.

image

If you want, you could also make the VerticalAlignment to the Center.

2 Likes