I was wrting a plugin and I want to get the postion of the given widget. I used Widget->GetCachedGeometry().GetAbsolutePosition(). The function works perfectly fine in the editor, but does not work in the packaged game. I tried both win64 and Android, and it always returns (0, 0). I checked with the source code and it seems that GetCachedGeometry() uses GetCachedWidget() and GetCachedWidget() returns a null widget in packaged game. That’s the reason why I always get (0,0) in the packaged game. How can I resolve this problem? Any help will be greatly appreciated.
FGeometry Geometry = Widget->GetCachedGeometry(); FVector2D AbsolutePosition = Geometry.GetAbsolutePosition();