So let’s say I want to send a command (set a bool or similar ) to hundreds of different blueprints. I’m reading into blueprint interface but i’m not sure this is possible. Can anyone help ?
if they are all in a certain area, do a multisphere trace, and run a for loop on the results, it will then parse through every matching result, from there you can set the bool.
OR
just set a bool in your gamemode, and get the other blueprints to periodically check it (slow)
You could use an EventDispatcher, though I’ve no idea how expensive that would be for hundreds of blueprints.
I don’t have the time right now to go into detail but here’s a setup for how to send an event to a lot of actors to get them destroyed:
Hope this helps. Good luck!
they are indeed all in the same area, could you explain more in details how to execute the first option please ?
The widget Blueprint looks good. However, in your target Blueprint, you need to bind your event to the widget dispatcher. That means you need a reference to the widget and I’m not entirely sure how to get that. Hmm… looks like there’s a GetAllWidgetsOfClass node that probably works same as GetAllActorsOfClass, so I’d try using that.
Basically, you do the following:
- in your target Blueprints connect the BeginPlay event (or another event guaranteed to happen before the button click) to GetAllWidgetsOfClass with your widget blueprint class
- if the returned array length is > 0, the first element is your widget
- drag out a wire from the returned widget and connect it to “Bind Event to 1x1 Building request” (in the widget blueprint!)
- connect the event to a custom event (as you already did)
- define whatever needs to happen in response to the custom event
Now when the button is pressed, this custom event gets triggered for all actors of this blueprint class. If you need several actors of different Blueprint classes to react to the button press, you need to bind custom events to the widget dispatcher in the other Blueprints, too.
I’m trying this method as well and i’ve read the wiki about it, ( https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/EventDispatcher/index.html ) still, i can’t make much sense of it. What I did was creating an event dispatcher in a widget and connect it to a button:
and then in a separate blueprint I have created another event dispatcher with the same name and connected it this way:
I know it’s wrong but I can’t replicate what’s happening in the link you posted, could you explain a bit further/what am I doing wrong ? thanks !
I’ve implemented the mutisphere and run a loop (i think i did) on the results. I’ve also connected that to a print string which tells me that the correct number of objects has been detected …
then is a separate blueprint, using the interface as shown here:
but it never triggers … what am I doing wrong ? Is this sort of what you meant ? thank you for your time !
Trying to follow but i don’t understand point 2 and 3 … how do i get the array length ? i tried this:
and it prints the umber 0
number 3; what is the returned widget ?