add widget (component) to widget in blueprint

It will not work. There is a tracing method that works - the Widget Interaction Component but that’s to interact with world space widgets when we have no mouse cursor - in VR or FPS where one points at things with their fancy controller or their, ehm, face instead… But I digress!


how do you add click events when you have created buttons in blueprints

Event Dispatchers. Buttons already come with the onClicked delegate:

Now we have 10 buttons that all trigger this event, and this event can be in another blueprint - it’s a matter of hooking it up.

how do you do it for an array of buttons

Perhaps there’s no need and you can bind buttons as above as you create them. You can, ofc, add them to an array:

Or even make one manually:

But it may make little sense in many cases. You can also query containers for their children once they’ve been populated:


Most importantly, consider not using buttons for this, at least not on their own - it leads nowhere, you’ll get stuck very soon. At the very least wrap buttons with User Widgets:

  • create a widget with just a button (you can prettify it):

Add a new :point_up_2: Event Dispatcher , some Instance Editable and Exposed on Spawn variables and have the native onClick call the dispatcher, piping in the data.

When you create custom buttons, use the usual Create Widget node, add them to the scroll box but instead of binding the mundane onClick bind to your new Event Dispatcher:

As mentioned above, you can have any blueprint listen to the dispatches:

Here, each dynamically created user widget button that sits in the scrollbox will have the Game Mode spawn a unique unit.

1 Like