Cast on interfaces does not work

I made an InteractionInterface interface in c ++ and cast on it in this way Cast <IInteractionInterface> (OutHit.GetActor ()); And it works, but only if the actor for which we are casting is written in c ++, if the actor is written in Blueprints, the casting does not pass and gives nullptr. By the way, if you cast in Blueprints, then the cast goes. But I want to be able to cast in c ++ for classes written in Blueprints. I know that you can initially create a class in c ++ and inherit the Blueprint class from it, but this is not convenient, not everyone can get into the c ++ part of the project and do what is needed there.

I just spent like 5 hours trying to figure this out with no hope, but I finally have a solution.

If a blueprint directly inherits the interface Cast<Interface> will ALWAYS return nullptr. C++ side has no idea the actor implements this.

Instead check if the actor implements the interface by:

UKismetSystemLibrary::DoesImplementInterface(Actor, USomeInterface::StaticClass()); // a bool

Then if that passes you can call the following wrapper function

ISomeInterface::Execute_SomeMethodNameHere(Actor);