RealDocs

UObject::Implements

function CoreUObject Since 4.0
#include "UObject/Class.h"
Access: public Specifiers: const

Description

Returns true if this object's class implements the specified UInterface. Works for both C++ and Blueprint-implemented interfaces via the reflection system.

Signature

template<class T> inline bool Implements() const

Return Type

bool

Caveats & Gotchas

  • The instance method is UObject::Implements<T>(). The class-side method is UClass::ImplementsInterface(UClass*). Do not confuse the two.
  • A class implementing the interface in C++ and a Blueprint adding it via the Blueprint editor are both detected correctly.
  • Uses the UClass interface table, not C++ virtual dispatch. Correct even for Blueprint-only interface implementations.

Example

Runtime interface check and execute C++
if (SomeActor->Implements<UDamageable>())
{
	IDamageable::Execute_TakeDamage(SomeActor, 10.0f);
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.