Moving widgets on a SCanvas at runtime

I’m trying to create clickable HUD widgets with Slate. These widgets (containing an icon and a label) are moving at runtime, following the projected positions of some actors. The reason I’m doing this with Slate is because the widgets are clickable, and it seems better than managing hit boxes on the canvas manually.

For this, I need to be able to move the SCanvas::FSlots containing the widgets, but I didn’t find a good way to get hold of them. On the forums[1] I discovered FSlot::Expose()[2], which returns a raw C++ pointer to the slot. It would work, but I don’t like having to store raw pointers in a list and make sure the list reflects the widgets lifetime.

Isn’t there a better way to do this ?


[1] Slate UI: Dynamic Menu? - C++ - Epic Developer Community Forums

[2] https://docs.unrealengine.com/latest/INT/API/Runtime/Slate/Widgets/SCanvas/FSlot/Expose/index.html

I think, there is no better way to handle an array of objects than array of pointers to them. =) You can easily check that array for any attribute you want (e.g. names of slot widgets) then.