Blueprint Communication Without References?

Even after watching the excellent training stream with Zak Parrish, blueprint communication still feels a little cumbersome to me at times. Let’s take the following situation for example:

Different robot enemies get spawned into the level and there’s a switch to trigger an EMP bomb. In a perfect world, I would simply implement an interface in all blueprints that can be affected by the bomb and message this interface from the switch blueprint to call an event. But in order to make this work, I first need references to all the relevant actors in the level. The only way I know to do this would be plugging in several “Get All Actors Of Class” nodes, one for each class that use the interface. But that’s generally discouraged due to being a slow operation.

I’m sure there’s a better solution to get those references, but is there any way to communicate without the need for references at all? Is it possible to simply execute an interface event on all the actors that have the interface implemented? If not, is it due to performance reasons?

Thanks in advance for any help on this matter!

No, there is messageing system in UE4 but is not avable via blueprint. You can easily avoid using “Get All Actors Of Class” by listing actors in diffrent way, make a array somewhere global (GameMode?) and make EMP bombs register themselves to that array and then they get destroyed remove them from the list then you loop thru them all and execute function you want. You could also try incorporate delegates, register EMPs to some event dispacher (thats how delegates are clled in blueprints) make a dispacher in GameMode and register EMP there and call that event when you need, might be actually be better and faster solution. Think out of the box and you may think other ways. You can try thinking if you really need to call EMP bomb, you might try to find way to detect trigger event from EMP bomb class, like using some external delegate somewhere

Note that there is no quantum computing here and everything happens in sequence (or else you do some multi threading which you can’t really do in UObject as well as blueprints) so “execute an interface event on all the actors” is impossible, even if there was massage system in blueprint that message system would loop thru all actors to deliver it to all of them anyway.

Thanks , that makes sense. I was hoping for an easy way out, but it seems like it doesn’t exist after all.

I was already considering using the GameMode to store arrays with the actors I need, but it felt like a clunky solution to me. I guess it’s still better than using “Get All Actors” a bunch of times though. Using event dispatchers might indeed be a good solution in the EMP example as well, so I’ll keep that in mind.