UKismetSystemLibrary::DoesClassImplementInterface
#include "Kismet/KismetSystemLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Checks whether a class (rather than an object instance) implements a given interface, whether native or Blueprint-defined. Useful when only a UClass reference is available, such as when filtering a class picker.
Caveats & Gotchas
- • Unlike DoesImplementInterface, this takes a UClass* directly so it works without an instantiated object — handy for validating classes before spawning.
- • Passing a null TestClass returns false rather than asserting.
Signature
static bool DoesClassImplementInterface(const UClass* TestClass, TSubclassOf<UInterface> Interface) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TestClass | const UClass* | The class to test. | — |
| Interface | TSubclassOf<UInterface> | The interface class to check for. | — |
Return Type
bool Example
Validate a class reference implements an interface C++
if (UKismetSystemLibrary::DoesClassImplementInterface(PickedClass, UInteractable::StaticClass()))
{
GetWorld()->SpawnActor(PickedClass);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?