I have the problem that an Function of an Interface which both is implemented in Blueprint is not called when calling the Interface Function from c++ Code. Both Blueprint call and c++ call using the same function of an BlueprintFunctionLibrary which is looking like this:
void UCallGlobalEvents::Call_Event1(struct Struct1 Meta, struct Struct2 InData)
{
TArray<AActor*> Actors;
UGameplayStatics::GetAllActorsWithInterface(GWorld, UGlobalEvents::StaticClass(), Actors);
for (AActor* Actor : Actors)
{
if (Actor->GetClass()->ImplementsInterface(UGlobalEvents::StaticClass())) {
IGlobalEvents::Execute_Event1(Actor, Meta, InData);
}
}
}
The crazy thing is the Pointer “Actor” is exactly the same if i call Call_Event1 from Blueprints and from c++, also both will execute the line “IGlobalEvents::Execute_Event1(Actor, Meta, InData);” but the interface call is only received when executing Call_Event1 from a blueprint but not if i execute Call_Event1 in c++.
It’s a BlueprintNativeEvent and you’re using GENERATED_BODY, so you need to define the _Implementation for the function as well in the Interface, even if it’s just blank. E.g.:
So also calling it from the Class as a Function is working. Any idea if if a dynamic Delegate which is calling the Interface can cause problem ?
So Function “X” which is trigger via a Dynamic Delegate, is calling the Interface. And it is successful once at the first time the Function “x” is called. After That, the c++ Code is executed but the Interface Function is never called again.
I copied the relavant path and made some … where its not necessary to post a lot of unrelated code. OnDataReceived() is the function where the Interface call is executed (see first post)