Get widget size

not sur it’s what you are looking for, but there is nothing to get that value directly. so here what i do :

if you want the size in local scale ( the one in editor ) simply use 
  void UStyleEffectWidget::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
    {
    Super::NativeTick(MyGeometry, InDeltaTime);
    screenSize = MyGeometry.GetLocalSize();
    }

if you want the real size rendered : ( parent scale and viewport )

	UPROPERTY()
		FVector2D screenPosition;
	UPROPERTY()
		FVector2D screenSize;

void UStyleEffectWidget::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
{
Super::NativeTick(MyGeometry, InDeltaTime);

screenPosition = MyGeometry.LocalToAbsolute(FVector2D(0, 0)); //TopLeft
screenSize = MyGeometry.LocalToAbsolute(MyGeometry.GetLocalSize()) - screenPosition; // BotRight-TopLeft = real size
}

Edit : without tick method :

auto geometry = GetCachedGeometry();
auto localSize =geometry.GetLocalSize();


auto screenPosition = geometry .LocalToAbsolute(FVector2D(0, 0)); //TopLeft
auto  screenSize = geometry .LocalToAbsolute(localSize ) - screenPosition; // BotRight-TopLeft = real size
1 Like

then you can use “GetCachedGeometry()”
( i Updated My answer )

Hey, I am trying to get my vertical box widget size.
I have tried GetDesiredSize function but it is not the real size, it represents the size considered its children, what I want is the “borders” size which I setted in the widget blueprint:

https://forums.unrealengine.com/attachment.php?attachmentid=145350&d=1497760344

How can I get it?

I prefer not creating a tick function

Another option is GetAbsoluteSize, it returns the same value.

1 Like

everyones acting like its just that easy but I can’t figure out how to access my widget’s FGeometry to call GetAbsoluteSize