Widget only shows one child

Hello,
I am creating a set of targets for a game. One feature is a control computer in which you can have a map showing the targets and interact with them.

In my map widget I would like to spawn multiple interactive icons (they get values from the targets and send events when clicked). I have set up this part like this, in the EventConstruct line:

For Each of the array, it creates a widget icon, which I set its “TargetRef” variable with the Array Element from the loop. This allows the icon widget to know which actor it is assigned.

Below that (not shown, where the two blue path are going), the Array Element is used, process them and adjust for the Set Position, which is pulled from the “Space for Targets” variable Overlay. I am not sure what I am doing here with the “Slot as Canvas Slot” but as I could get a Set Position which is nice.

Further than that it’s just an Add Child.

However when I test it, only one of the widget is shown. I planted my blueprint with printstrings, tried multiple things and I can tell the following:
-each child is created (child count goes up as the loop goes)
-each instance of the ForEachLoop returns a different set of coordinates, which is normal and what I want
-everytime I add more targets, the last spawned target is the one to appear, all the others are not shown

If I don’t use “AddChild” but “AddToViewport” instead it works, however I need to create an array to contain their references to delete them when I close this widget. I’m not sure it really affects performance, however for the form and training I would like to know/learn with the child.

I’m really not sure what I’m doing wrong, and it’s probably a small problem, but I’ve been looking for hours and I can’t make progress alone. Thanks for any help on this (even if it’s just informing me I can’t use child for this)

The script, the logic and your description all make sense to me.

which is pulled from the “Space for
Targets” variable Overlay.

This is the issue - Slot as Canvas Slot is for Canvases.

Since your panel is an Overlay, use Slot as Overlay Slot instead.

Glad to hear that. To clarify, each panel creates a different type of slot with different properties. Canvas slot will have access to anchors, vertical box will not, for example. Uniform grid slot will have rows and columns, and so on…

254977-untitled.png

So I went and toyed with those only to realize I’m referencing the wrong way. In my first tries I was changing the overlay location, not the icon. This is what I came up with and it seems to work just fine

I also need to read again through the slot documentation as it is obviously not clear to me.

Thanks for the help anyway, indirectly made me found my mistake!