Download

Can I have an Event Dispatcher from the Level talk to every actor at once?

I have trigger volumes in my level that make every object in the game perform a certain action at once. When looking at how to do Event Dispatchers, you typically select a particular object to call the event inside of, right? I want a trigger to call the “Level Up” function inside every actor in the level. I still can’t wrap my mind around Dispatchers as a whole, so let me know if I’m approaching this the wrong way.

Hello,
In your situation, i think i would use an interface instead of an event dispatcher.

Thanks! I hadn’t heard of those before. I can get it working right if I reference one of my actors directly, but it doesn’t work when using an “All Actors” variable that references the ‘Actor’ object class. Here it is inside my level blueprint.

&stc=1

I figured it would be too easy to just use the Actor class, but I’m unsure how else I can reference an ever-growing list of assets and props.

To know how to set your interface, have a look at content example in blueprint_communication : 3.1 : this is a trigger overlap event which activates 3 different blueprints via an interface.

Okay, I looked at the Content Example and the tutorial link you sent me. They create the Array by assigning objects to slots within the button’s detail panel in the editor. However, A) it doesn’t work that way with Level Blueprints or other non-actor classes, and B) it references individual actors within the scene, and not classes as a whole. I’ll keep looking into it

Hi StephaBon. Can you try the below setup?

The function GetAllActorsWithInterface can be costly if you have a large amount of actors in the level. A more efficient way would be using a “dispatcher” actor, which contains many event dispatchers used for level->actor/actor->level communication and is placed on your level. Actors then use GetAllActorsOfclass to get a reference to the dispatcher and can subscribe only to the events they are interested in. The level blueprint can also subscribe to events so you can have actor->level communication.

Thanks, ryanjon2040, that did the trick! This type of function won’t be called very often, so I’m not too worried about the performance cost. If it becomes an issue I’ll definitely try your method, Pedro. Thank you all for your help.