[UMG] What's the proper way to get widget size before I place it into game?

I found a solution I thought really good, but some weeks later the solution was found to work only in editor mode when I tried to package.

I have a UMG with custom size 1000x100. I need the design size to dynamically arrange my widget component’s position.

UUserWidget::DesignTimeSize much meets my needs, but it works only in editor mode.

I tried to get the canvas’ geometry, but there are two problem:

  1. the geometry is not ready before I place it;
  2. the size I got from GetLocalSize() is the DrawSize of the widget component, not the UMG’s design size.

What’s the proper way to get the UMG’s size?

1 Like