Why is children image affect on parent size?

Hello. I want to create a button with additional image inside it. The only way I know how to achive it is to add children to my button, so I’m getting this:
image
The problem is the button should look more round. It looks ok when there is no image inside it:
image
So my question is why does it happening and how to make the button to ignore size of child image?

Many ways, hopefully; what are you placing the buttons in?

Essentially, when you add something to the button, it will report how large it wants to be (the image) and the button will try to accommodate it. But the button must also conform to the container it was placed inside of itself.

Is this…

image

… a horizontal box sitting in a canvas? Are the buttons trying to squish themselves into it? Show us the widget hierarchy if possible.


Also UE5 has a nasty regressed bug where images do not set their size properly.

Sure. Here’s hierarchy:
image
I’ve selected a button.

Have the buttons fill the space inside the horizontal box, ensure the box is large enough. The scale boxes sit in the canvas, set their size directly.

I’m not sure about it. My button’s size is setting automatically:


And other buttons looks ok, so the problem is in image. I can try to adjust it, but image will be distorted:

Can you show the detail panel of a button?



It’s not set to Fill at all.

Oh, I suppose I understood you wrong when you talked about “fill”. Yes, the button’s proportions is better now. So it’s an answer. Can you please explain why is it working or I just should mark your sentence as an answer?

The button was set to Auto; since it had a small image child, it tried to resize to fit that child.

When you set the button to Fill instead, it tried to occupy as much space inside its own container (horizontal box slot) as it could.

1 Like

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