How to check for an Actor and Its Children Actor for being of X class

I am looking for a way to check if my hit result is from X class and the screenshot below works as intended, returning true if that indeed the right class.

Q:
However I would like it to also return true when the hit actor is a child of that same parent class.
Currently it doesn’t do that.

I could make an array of all children and loop them but It seem a bit ridiculous\overkill?

Thanks anyone!

1 Like

If the hit actor is a child of class X, the it should pass as being of type X.

If that fails, then cast to class X.

If that fails, then it’s not actually a child of X :slight_smile:

1 Like

image

For future reference, this does the trick.
Now I am not entirely sure why the == doesn’t work anyway, but reading your answer helped me to not wander too off path looking for a solution.

Thanks you for your time, and attention!

1 Like

Ah, == is ‘exactly’, so yes, I guess it would fail.

A cast would work though.

Or what you have :smiley: