Download

UMG: CanvasPanel children aren't resizing to parent panel

We are attempting to create an empty HUD widget that separate HUD elements can be parented to in order to have a singular parent canvas.

For the parent HUD widget, we are creating a widget with a CanvasPanel (and nothing else).

We have a child HUD widget with a CanvasPanel and a Text child anchored to the lower-right.

When the child is parented via Blueprint (using Add Child to Canvas followed by setting Auto Size to true), the child widget appears to be of an arbitrary size! I would expect it to resize into the parent’s CanvasPanel.

Is this a new/known issue or expected behavior?

Ideally, we want child widgets anchored to a parent widget, so a Status Meter (for example) can be its own widget blueprint anchored to the lower-right. And a central HUD widget parent can be used to change visibility, etc on its children.

Thanks!

Auto Size means size the canvas’s slot to match the desired size of the content of the slot.

That would explain why Auto Size isn’t the solution. Is there a way to cause the child widget’s CanvasPanel to be auto-sized to its parent?

You could change the Anchors of the child’s slot to be min(0,0), max(1,1). If you want the child to fill the parent, why are you using a canvas as the parent widget? An Overlay would be a much better choice if you just want to fill the parent.

Thanks! We’ll try that when we next update our HUD. We were using a Canvas out of ignorance. :slight_smile: From reading online, it appeared that the Overlay has a flow control; we were worried about flow control messing with placing multiple screen-sized children into it.