We are trying to move our implementation to the “Implement to interfaces” paradigm, where everything is an implementation on an interface
Interfaces cannot have “event dispatchers”, so we tried to pass the event to function in the interfaces then bind it in the implementation as we can do in normal class function
Unfortunately, we could not do that, we cannot define an interface function parameter of type “delegate”
In a class, I can create a normal function that take an event as a parameter and bind it to a dispatcher, I cannot make this an interface function as I do not know how to define it in the interface
This might be an old thread but wanted to document how I’ve achieved a solution for a similar problem:
Problem
We were developing a system of minigames, which included some events sensitive to the minigame information (OnClose, OnClompeted, OnFail, etc…)
This needed to be an interface, as parenting UI widgets was not an option at the time. This lead to the error: we can’t have neither Delegate parameters nor EventDispatchers on interfaces (and for other reasons, C++ wasn’t an option)
Solution
We’ve created an Object type class called MinigameDelegates where we can specify any event we would want.
Then, on the interface itself, we’ve implemented GetMinigameDelegates which return this very object for any other class that need this info.
The only downside is that we need to make an Valid check on each one of the classes that implements our interface, but this surely was a backdrawn we were willing to take
There is no straightforward solution I can think of in C++ either to support this in blueprints. If you try to use an event delegate as a function parameter for your interface and make that function BlueprintCallable, you’ll get slapped with the following compiler error:
Type 'YourEventDelegate' is not supported by blueprint.