Setting size of a widget on an actor

I’m learning Unreal and I can’t seem to figure this out. How do I set/constrain/define the size of a widget (text/image/etc) on an actor?

I have an actor (a card for a card game), which are the orange rectangles on the bottom row (your hand of cards). I’m dragging and dropping them onto the board. Which is great. But now I’m trying to add graphics and text to the cards, and am struggling to learn how to do this properly.

I created Widget Blueprint, added a Canvas Panel, and added my widget to my Card Actor. It didn’t show up at first, but once wrapped the Canvas Panel with a retainer box, then it showed up. Should I always wrap the canvas panel with a retainer box for it to show up?

Here is the main problem. I’m trying to fit text and images onto the card, and have them show up and look normal on the card actor in the game. But everytime I put text/images on the widget, the positioning is not what is expected. I discovered Size Boxes and have been playing around with them, but it’s been a nightmare trying to get the size correct. Do I add a size box as a child to the canvas panel? Or wrap the canvas panel with a size box? I’ve tried one, the other, both, etc.

Screenshot 2024-08-07 at 9.26.19 AM
Here is the format I’m going for. I want it to look like a playing card, where you have a main graphic, a name on the bottom, and a few numbers in the corners. But I don’t know how to set the size/constraints of the widget in order to achieve this.

Here is the current screwed up form of my widget and card lol


The size box seems to only apply to the image. So I tried wrapping a size box around the canvas panel, no idea if that’s the right thing to do. But regardless, i have to guess and check on sizes when it comes to the actor. It’s a totally mess. Can’t I just specify a size and have it fill to that size?

Thanks

This video was super helpful and has solved my problems. I’m not 100% sure I’m doing things the most efficient way possible, but at least it’s working now. So I didn’t even need a canvas panel. I didn’t know you didn’t need one. I started with a size box as my first item. Then I can even used nested size boxes which was super helpful as well. The canvas panel is likely what was screwing me up, I didn’t want that for this use case

You do not need the Size Box either (at least not for this). When you work with widget components in world space, they provides the desired size here:

The widgets will conform to it. To make it easier in the designer, set it to the same custom size:

image

So you can edit in the same space the widget component will utilise.

1 Like

Good to know. I was using a size box AND the draw size, so I was just being redundant.

Thanks

1 Like