# Why is children image affect on parent size?

**URL:** <https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310>\
**Category:** UI\
**Tags:** parent, image, child, unreal-engine, Widget, question\
**Created:** [July 31, 2023, 8:55pm UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310 "2023-07-31T20:55:58Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Texn0krat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Texn0krat](https://forums.unrealengine.com/u/Texn0krat)\
**Post date:** [July 31, 2023, 8:55pm UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310/1 "2023-07-31T20:55:58Z")

</div>

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/9/3/993dc04fdf33922c01c2e6bb47e36613a2412ada.png)  
The problem is the button should look more round. It looks ok when there is no image inside it:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/c/94c7bf7c2a9f2625863dd2e98f9a41d3f8586e2a.png)  
So my question is why does it happening and how to make the button to ignore size of child image?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 1, 2023, 4:57am UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310/2 "2023-08-01T04:57:00Z")

</div>

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/9/0/790fa7ba47b5c1109ac904ef2b8788e9c6bde021.png)

… 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.

---

<div class="post-metadata">

**Author:** ![Texn0krat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Texn0krat](https://forums.unrealengine.com/u/Texn0krat)\
**Post date:** [August 1, 2023, 5:18pm UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310/3 "2023-08-01T17:18:22Z")

</div>

Sure. Here’s hierarchy:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/0/0/60001b105201efddade505b217c79662e96d9086.png)  
I’ve selected a button.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 1, 2023, 6:14pm UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310/4 "2023-08-01T18:14:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Texn0krat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Texn0krat](https://forums.unrealengine.com/u/Texn0krat)\
**Post date:** [August 1, 2023, 6:32pm UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310/5 "2023-08-01T18:32:30Z")

</div>

> [@Everynone](#):
>
> Have the buttons fill the space inside the horizontal box, ensure the box is large enough

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

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/a/d/bad7eeca5dc58b83d762db82cde2cf678a2d7ef6.png)  
And other buttons looks ok, so the problem is in image. I can try to adjust it, but image will be distorted:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/9/0/c909671f33952ce77935b07dc18ec3e6d8309eca.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 1, 2023, 6:50pm UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310/6 "2023-08-01T18:50:15Z")

</div>

Can you show the detail panel of a button?

---

<div class="post-metadata">

**Author:** ![Texn0krat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Texn0krat](https://forums.unrealengine.com/u/Texn0krat)\
**Post date:** [August 1, 2023, 6:59pm UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310/7 "2023-08-01T18:59:27Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/9/e/09ead6b14d2ec05524b199cabc75043c90794768.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/9/5/395e0e5cccd56048c3bcbc42337860557be3a10a.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/2/3/a23c9ffb84ad285b298d127fd63cac99c285b858.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 1, 2023, 8:26pm UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310/8 "2023-08-01T20:26:54Z")

</div>

It’s not set to Fill at all.

 ![Screenshot_20230801_222724_Chrome](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/4/3/d4390b7ebf5bb50e9072a308f16df63f5f6c7bf7.jpeg)

---

<div class="post-metadata">

**Author:** ![Texn0krat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Texn0krat](https://forums.unrealengine.com/u/Texn0krat)\
**Post date:** [August 1, 2023, 8:40pm UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310/9 "2023-08-01T20:40:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 1, 2023, 8:57pm UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310/10 "2023-08-01T20:57:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [August 31, 2023, 8:58pm UTC](https://forums.unrealengine.com/t/why-is-children-image-affect-on-parent-size/1246310/11 "2023-08-31T20:58:09Z")

</div>

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