[UMG] Custom widget size

I have made a custom widget and want to get the size of the entire widget that’s placed in a different widget dynamically within a function in the widget.

Eg: I created a general widget for my game that contains an image, I want that image to center fill to the maximum width/height however to do so I need the size of the widget when it’s placed in another widget. So far I have a function within my general image widget which takes a Texture2D and a Size parameter. The size of the widget when created is passed into the function from another widget and would like to avoid the need for this and just get the size of the widget within the widget itself.

I read somewhere that it’s not possible until you wait for a single Tick, is this true? Could someone post an example of getting the size of a widget within a function of that widget please?

Try using a ‘scale box’ inside your Parent widget, I dont think you can get the size that way but if it works I dont think you will need to

I tried a scale box but does not provide what I need for images unless there’s a way to force the image to be a certain ratio?

Bump, any way to get a custom widget’s size / position (within its own blueprint) on the canvas?

Don’t know if you can get these numbers. The custom size is basically it’s viewable bounds. Like the world it Goes on indefinitely in X and Y.

I think your trying to accomplish a modularity to it? Like drag and drop and its inside another umg in the correct size?

Not sure you can and as far as position when it’s custom size it’s position is relative to what you place it in. So you are not predefining it in the widget itself. Like a physical object it doesn’t take on a home position by default you define that in the other widget.

Example I make a widget for a radar that is 500 wide by 500 tall. Custom size that’s all there is to it.

I place it in another widget in that widget I need to again define its size and now location. This is left open because maybe scaling is involved. the widgets act independently and for good reason. My radar code is using its own coordinates to define where a dot should be to represent a radar object. It needs to work independently of anything else.

So as always I’ll ask for context what are you trying to accomplish? And what do you find to be a constricting factor in this. There may be other ways to approach your problem.