helo, i’m trying to create a context menu and an item inspector for my inventory, both should appear next to the slot and in both i’m not using a canvas panel. The way that i’m doing is: i’m getting the slot position and passing it to the HUD, which then passes it to these widgets to set their positions. However, it’s not working, and it’s not responsive: if I reduce the screen size, the widget moves extremely far away.
in full screen:
in widow mode:
here how i get my slot position in the slot widget:
FVector2D UInv_ItemSlot::GetSlotPosition() const
{
FGeometry Geometry = GetCachedGeometry();
FVector2D WidgetCenter = Geometry.GetLocalPositionAtCoordinates(FVector2D(0.5f, 0.5f));
FVector2D PixelPosition;
FVector2D ViewportPosition;
USlateBlueprintLibrary::LocalToViewport(GetWorld(), Geometry, WidgetCenter, PixelPosition, ViewportPosition);
UWidgetLayoutLibrary::GetViewportScale(this);
return PixelPosition;
}
and i get the slot position in my inspector and context menu and do this:
SetPositionInViewport(SlotPosition, false);
i already tested using false to bRemoveDPIScale, but nothing has changed
here my widget setup in editor:
i’m using a scale box to override the size, and it’s set to desire on screen with a value of 0.5 in pivot