How to use ->IsA to check is an actor is of a class

I am trying to use

(ProjectileClass->IsA(ABaseProjectile::StaticClass()))

But its showing me error and tells me to use

(ProjectileClass->IsChildOf(ATripleProjectile::StaticClass()))

Instead.

Is there anyway to do this direct comparison to check instead of using IsChildOf ?

You’re using IsA to checking the class itself!

For Classes, use Childof

for Actors, use IsA

#Solution

if(YourActor->IsA(ABaseProjectile::StaticClass()))

Rama

5 Likes

The problem is ->IsA is giving me error and intellisense says me to replace it with ChildOf

but you are writing

ProjectileClass->IsA

you should not be using the class,

you should be using an actual actor

   AMyProjectileClass* SomeProjectileInstance = //spawned somewhere;
    SomeProjectileInstance->IsA

:slight_smile:

ChildOf is for direct class comparison

IsA is for instances of a class

Rama