so i have a child widget select_opponent_button connected with this widget and i need this blueprint to dynamically show as many butttons as there are enemies spawned,
the enemies are an actor called enemy
The enemies array is empty.
- how, when, where do you create and add this widget to the viewport?
- how, when, where do you spawn the enemies?
- the level BP spawns enemies.
Got it. - the level BP spawns creates the widget has the other widget that needs to know about the enemies
Got it.
Thanks!
Could you explain how this bit works:
You say you spawn many enemies., right? How do you do that. Is there a loop somewhere here?
Does this script run on Begin Play?
As you can see from the image it doesn’t always spawns some enemies thanks to random bool with weight. It can spawn up to three enemies to three different target points and no it runs on begin overlap with a trigger box that is placed on the level ( the widget creation and enemy spawn )
the bp doesn’t have any loops
- flag the widget enemy list as
Instance EditableandExposed on Spawn
- spawn enemies, keep them in an array (you did say up to 3)
- once the loop (or however you make it up to 3) completes → create widget → pipe in the enemy list
This way the widget Construct can use the array straight away. But you can also keep adding them as you spawn the actors.
hold on the array i have is at the widget blueprint and not at the level bp where i spawn enemies, how will i fill the array then?
As shown above, if you want to use the widget construct. You don’t need to, you can add to elements to the widget’s array instead. But then you cannot construct in the widget.
in the create widget how did you make the enemies node?
Look at the first bullet point of my post.
the create widget has that enemy array node, how do i make it since the method on post 12 indeed has the issue of not being able to add it to viewport afterwards
for the first imge is the add enemies a custom event in the widget?











