How to call interface method from c++?

To call a function with params:

IGetInteractionComponent::Execute_NameOfFunctionToExecute(Owner /*Object which implement interface */, Param1, Param2)

“ImplementsInterface” method will always work, whether the interface has been implemented in c++ or Blueprints.
There are also two more ways to check whether an object implements a c++ or Blueprint interface:

// 1
if(Owner->Implements<UGetInteractionComponent>())
{
}
// 2
if(UKismetSystemLibrary::DoesImplementInterface(Owner, UGetInteractionComponent::StaticClass())
{
}

For c++ only interfaces you can use Cast method. It’s a bit faster.

2 Likes