My Widget Hierarchy
–Canvas
----- Vertical Box ( Canvas Slot )
------------ Button1 ( Vertical Box Slot )
------------ Button2 ( Vertical Box Slot ) <- I want to attach left side custom widget “CustomMenu”
…
–CustomMenu ( Canvas Slot )
I want to set dynamic position “customMenu” at “button2” left side… How to get “button2” canvas position ??
[my code]
auto canvasSlot = UWidgetLayoutLibrary::SlotAsCanvasSlot( “Button2” ); <- Cast is null !!!
if (canvasSlot)
{
FVector2D position = canvasSlot->GetPosition();
position.X += canvasSlot->GetSize().X;
UWidgetLayoutLibrary::SlotAsCanvasSlot( “CustomMenu” )->SetPosition(position);
}