When I run this code here:
AActor* actor = hitResult.GetActor();
IUnit* IUnitActor = Cast<IUnit>(actor);
bool bIsIUnit = actor->GetClass()->ImplementsInterface(UUnit::StaticClass());
IUnitActor is null, while bIsIUnit is true.
The actor doesn’t implements the interface in C++ code, but in his blueprint editor.
Why does the cast returns null and how can I call functions from the interface on the actor?
Or do I need to create a C++ class that directly implements the Interface?