Download

Access to Event Dispatchers in Interfaces

I believe there are some nice design patterns that can be done in Blueprints if Blueprint Interfaces could support the passing of Events/Event Dispatchers. The biggest idea being that it can be useful to have an interface that expects a delegate to be called, but the implementation of calling that delegate could differ between concrete classes.

Designs with this pattern can already be achieved in C++ but Blueprints currently have no way of passing an event other than the one-off means of the Bind/Create Event nodes.

I don’t think interfaces should contain anything. They should be that, an interface and leave the implementation details to the class that implements the interface.

You should be using actor components instead of interfaces if you want events. Components have all the functionality of an interface:
Cast an actor to an interface-> get component by class
Call an interface function-> call a component function
Implement an interface function-> bind to a component event

Plus you have the bonus of being able write code and store variables within a component.
The only benefit a blueprint interface has over a component is that the interface can be implemented by a component. If anything, blueprint interfaces should be removed and replaced with the ability to add components to component blueprints within the editor.

I agree that this would be really useful, Allar.

How exactly are you achieving this in C++? If you implement the C++ defined interface with a blueprint, can that delegate then be assigned to or called in Blueprint?

Ohriginal,

Interfaces can be put on Actors and Components which is one of the reasons they’re needed. I also can avoid a deep and confusing inheritance chain using Interfaces.

And Allar is right, there needs to be a good way to define/bind events via interfaces.

Hi there, there is some news about it since? I agree that this would be a really usefull feature too!