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