RealDocs

UGameplayStatics::ObjectIsA

function Engine Blueprint Since 4.0
#include "Kismet/GameplayStatics.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Returns true if the given object is an instance of (or inherits from) the specified class. The Blueprint display name is 'IsA', matching the equivalent node in the Blueprint editor.

Caveats & Gotchas

  • In C++, prefer using Cast<>() or Object->IsA<TargetClass>() directly — they are equivalent in behaviour but avoid the overhead of Blueprint-callable dispatch and are more idiomatic in native code.
  • Passing a null Object returns false (not a crash), but passing a null ObjectClass will assert in Debug builds and produce undefined behaviour in Shipping builds.
  • This checks the full inheritance chain, not just the direct class. An ABP_MyCharacter that inherits from ACharacter returns true when tested against ACharacter.

Signature

static ENGINE_API bool ObjectIsA(const UObject* Object, TSubclassOf<UObject> ObjectClass);

Parameters

Name Type Description Default
Object const UObject* The object to test.
ObjectClass TSubclassOf<UObject> The class to test against.

Return Type

bool

Example

Check if an actor is a specific type before casting C++
if (UGameplayStatics::ObjectIsA(HitActor, AEnemy::StaticClass()))
{
    AEnemy* Enemy = Cast<AEnemy>(HitActor);
    Enemy->TakeDamage(50.f, FDamageEvent(), nullptr, this);
}

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.