{ }Blueprint → C++

Unreal Engine 5 · Blueprint → C++

Call an Interface Function in Unreal Engine 5 C++UE Docs

Call an interface function safely by first checking Target->Implements<UMyInterface>() and then invoking the generated static wrapper IMyInterface::Execute_Interact(Target).

Blueprint node & C++ equivalent

C++
if (Target->Implements<UMyInterface>())
{
  IMyInterface::Execute_Interact(Target);
}

How to call an interface function in C++

Use the templated Implements<UMyInterface>() on the target UObject to confirm it actually implements the interface. Passing the U-class as the template argument is required; the function returns true only if the object's class declares the interface.

Then call IMyInterface::Execute_Interact(Target). This Execute_ static wrapper is generated by the engine for BlueprintNativeEvent functions and routes the call to either the C++ _Implementation or a Blueprint override, whichever exists.

Why use Execute_ instead of calling directly

For BlueprintNativeEvent interface functions you cannot reliably cast and call the function directly, because a Blueprint-only implementer has no C++ vtable entry for it. The Execute_ wrapper handles both native and Blueprint implementers correctly.

Guarding with Implements<>() prevents calling Execute_Interact on an object that does not implement the interface, which would otherwise assert or misbehave. This pairing is the standard, crash-safe pattern in UE5.

When to use it

Use this pattern any time you have a generic AActor* or UObject* and want to invoke interface behavior without knowing the concrete type, for example calling Interact on whatever the player is looking at. It is the C++ equivalent of dragging a Blueprint Interface Message node.

Frequently asked questions

How do I check if an object implements an interface in UE5 C++?+

Call Target->Implements<UMyInterface>(), passing the U-prefixed class. It returns true for both C++ and Blueprint classes that implement the interface.

What is the difference between Execute_Interact and calling Interact directly?+

IMyInterface::Execute_Interact(Target) is the engine-generated wrapper that works for Blueprint and C++ implementers of a BlueprintNativeEvent. Calling Interact directly only works for C++ implementers and can miss Blueprint overrides.

Can I use Cast<IMyInterface> instead of Implements?+

Cast<IMyInterface>(Target) works for C++ implementers but returns null for Blueprint-only implementers. Use Implements<UMyInterface>() plus Execute_ to safely support both.

Related Interfaces nodes

View all Interfaces nodes →