Download

Combine BOTH Event Dispatchers and Interfaces for BP communication?

Can any BP experts suggest a scenario when you might want to implement BOTH Interface and EventDispatcher mechanisms to communicate between 2 BPs?

I can’t think of any scenario.

If you want A and B to be decoupled while having B call an event on A then you would use an Interface on A and B would need an object reference to A to call the interface on A.

If you want to use an event dispatcher then also using an interface is meaningless since if B has the event dispatcher then A needs to know what class B is to bind to it. You can’t bind to an event dispatcher through an interface.

What you might be looking for is inheritance combined with Event Dispatchers.
If A needs to know when B (dog) is hungry then the dog should have a base class of type Animal with a hungry event dispatcher. Then A can bind to B(dog object) but only cast to type Animal.

Not seen it used in the wild either, but I’ve had a need for it when communicating between the Level-Blueprint (LevelBP) and other BP’s, as that part is more complex than just regular BP-to-BP comms. The reason is down to getting a reliable reference to the LevelBP, particularly if you have multiple levels or incrementally rename it. Then things may break.

Interested to know if there’s another way to do this (getting a ref to the persistent level through the level-streaming helpers maybe?). But anyway I approached it like this. You can reliably get a reference to the LevelBP by registering it with a Gamemode-owned EventDispatcher, and using that as a pivot or Interface link between other BP’s & LevelBP.

LevelBP → Bind-To-Event → Gamemode. Level-Blueprint-Event_EventDispatcher

Generic BP’s → Call Gamemode.Level-Blueprint-Event_Interface

Gamemode → Level-Blueprint-Event_Interface → Call Level-Blueprint-Event