UKismetSystemLibrary::DoesImplementInterface
#include "Kismet/KismetSystemLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Checks whether an object implements a given interface, whether it's a native C++ interface or a Blueprint interface. Shows as the "Does Object Implement Interface" node.
Caveats & Gotchas
- • Passing a null TestObject returns false rather than asserting, so it's safe to call on unvalidated references.
- • For Blueprint interfaces, this checks the object's implemented interfaces list, not whether individual interface functions are overridden — a class can implement an interface without providing meaningful overrides for every function.
Signature
static bool DoesImplementInterface(const UObject* TestObject, TSubclassOf<UInterface> Interface) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TestObject | const UObject* | The object instance to test. | — |
| Interface | TSubclassOf<UInterface> | The interface class to check for. | — |
Return Type
bool Example
Check before calling an interface function C++
if (UKismetSystemLibrary::DoesImplementInterface(TargetActor, UInteractable::StaticClass()))
{
IInteractable::Execute_Interact(TargetActor, InstigatorPawn);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?