How do you get what type of character my projectile has it?

I have a function that is triggered when my projectile collides with:

void AProjectile::OnHit(UPrimitiveComponent *HitComp, AActor *OtherActor, UPrimitiveComponent *OtherComp, FVector NormalImpulse, const FHitResult &Hit)
{


}

The “OtherActor” returns the AActor I have it and obviously there is the FHitResult. How do I get the type of the class my projectile hits. I think you have to use UObject or UClass but cannot figure out how to do so.

You can use the GetClass function which will return the class name from the actor found in Hitresults OtherActor. Depending on your class naming, this might be used to determine the type of object hit.

Or you can assign tags to the objects that should react to a hit, e.g. a tag named “canbehit” - so to simply determine, if it should react on a hit. Then use the OtherActor->ActorHasTag function to check.

Also check for ApplyDamage functions. There’s an excellent tutorial by Mathew Wadstein found here