I have tried TScriptInterface<IWorker> const& in place of [something], which sort of works, but not if I want to assign it to an internal IWorker pointer. I have also tried IWorker *. Is there a protocol for passing a pointer to an interface inside a function call (in anoppther interface). I have done this in blueprints, but no luck so far in C++.
class IWorker
{
GENERATED_IINTERFACE_BODY()
UFUNCTION(BlueprintCallable)
void SomeFunction(); // The abstract interface method
};
As for creating functions that take IWorker as parameters, AFAIK this is a limitation of the UnrealHeaderTool: it doesn’t generate the proper code to handle TScriptInterface arguments, so you need to do it manually like this:
I have a further question. I am trying to pass a pointer to the function. It is a pointer to a class that implements the interface, and I am getting an “error C2440: ‘initializing’: cannot convert from ‘ClassName *’ to ‘IInterfaceName *’” Is there any way around this. The UnrealHeaderTool also didn’t like when I used “TScriptInterface<IWorker> worker” instead of “TScriptInterface<IWorker> const& worker”
Hi, did you find the workaround for this? I am trying to use interfaces as the function parameters and return types, but it can work only with const references which is not what I want to get.