If I have a property of the form:
UPROPERTY(Replicated)
TScriptInterface Property;
where IInterface is an interface I have created in C++, and I have an AActor *MyActor, I can determine that this actor implements my interface by:
IInterface *MyInterface = Cast(MyActor);
if (MyInterface != nullptr)
{
// MyActor implements IInterface
}
However, If I then want to assign MyInterface to SomeObject.Property, I get the error:
void FScriptInterface::SetObject(UObject *)’: cannot convert argument 1 from ‘IInterface *’ to 'UObject *
How can I store a reference to this interface for later use?