# How to force an actor array to recognize a class

**URL:** <https://forums.unrealengine.com/t/how-to-force-an-actor-array-to-recognize-a-class/485642>\
**Category:** Community & Industry Discussion\
**Tags:** array-nodes, Class, overlap-actors, unreal-engine, Array, question, actor-class\
**Created:** [July 2, 2021, 1:29am UTC](https://forums.unrealengine.com/t/how-to-force-an-actor-array-to-recognize-a-class/485642 "2021-07-02T01:29:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_b3bc4d7a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b3bc4d7a](https://forums.unrealengine.com/u/anonymous_user_b3bc4d7a)\
**Post date:** [July 2, 2021, 1:29am UTC](https://forums.unrealengine.com/t/how-to-force-an-actor-array-to-recognize-a-class/485642/1 "2021-07-02T01:29:54Z")

</div>

So, I have a complex question that I’m not sure how to describe. I have a box collision on one “enemy” that is supposed to detect neighboring enemies, which is fine and dandy. But later, said enemies need to perform an input. My “ComponentOverlapActors” node outputs an array of actors, but I need to find a way to either make the node output an array of the enemies’ class, or convert the actors array into an enemies array, so that I can tell all actors(enemies) within the array to perform the input.  
342997-  
 ![342996-code-screencshot-1.png]()

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b3bc4d7a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b3bc4d7a](https://forums.unrealengine.com/u/anonymous_user_b3bc4d7a)\
**Post date:** [July 2, 2021, 1:51am UTC](https://forums.unrealengine.com/t/how-to-force-an-actor-array-to-recognize-a-class/485642/2 "2021-07-02T01:51:42Z")

</div>

Okay, I found a work-around, but this seems clunky, is there an easier less code consuming way to do this?

![342998-code-screenshot-2.png]()

---

<div class="post-metadata">

**Author:** ![zeaf](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zeaf/32/1108035_2.png) [@zeaf](https://forums.unrealengine.com/u/zeaf)\
**Post date:** [July 2, 2021, 2:32am UTC](https://forums.unrealengine.com/t/how-to-force-an-actor-array-to-recognize-a-class/485642/3 "2021-07-02T02:32:00Z")

</div>

If I understood correctly, I think what you need to do is do a for each loop on your Actors array, and then drag from the array element pin and cast to Enemy Jump. If that cast succeeds, it means that the current array element is an Enemy Jump actor, and, you can then call your Swift Kill function on it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b3bc4d7a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b3bc4d7a](https://forums.unrealengine.com/u/anonymous_user_b3bc4d7a)\
**Post date:** [July 2, 2021, 5:00am UTC](https://forums.unrealengine.com/t/how-to-force-an-actor-array-to-recognize-a-class/485642/4 "2021-07-02T05:00:31Z")

</div>

Ya, but the problem is that I physically can’t connect a general actor array pin (or a non-array actor pin) to a enemy array input, the blueprint just rejects it (unless there is an override for this?). Part of the problem is that I don’t know how to tell the engine that the only results that should be getting returned are enemy actors, so it should make a enemy array, instead of an actor array (which is non specific, and then the engine thinks that the actor pin and enemy input are non-compatible, since an actor could be ANY actor).

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b3bc4d7a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b3bc4d7a](https://forums.unrealengine.com/u/anonymous_user_b3bc4d7a)\
**Post date:** [July 2, 2021, 5:04am UTC](https://forums.unrealengine.com/t/how-to-force-an-actor-array-to-recognize-a-class/485642/5 "2021-07-02T05:04:35Z")

</div>

Or do you mean making a “cast to enemy” node, using the actor pin, and then if cast fails, then blah, and if it works, then just use the “As enemy” output to perform the “Swift Kill” Input? This seems like it would work well!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b3bc4d7a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b3bc4d7a](https://forums.unrealengine.com/u/anonymous_user_b3bc4d7a)\
**Post date:** [July 2, 2021, 5:08am UTC](https://forums.unrealengine.com/t/how-to-force-an-actor-array-to-recognize-a-class/485642/6 "2021-07-02T05:08:26Z")

</div>

YEEEEESSS It does work, much less clunky than before! Thank You!

---

<div class="post-metadata">

**Author:** ![zeaf](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zeaf/32/1108035_2.png) [@zeaf](https://forums.unrealengine.com/u/zeaf)\
**Post date:** [July 2, 2021, 5:08am UTC](https://forums.unrealengine.com/t/how-to-force-an-actor-array-to-recognize-a-class/485642/7 "2021-07-02T05:08:47Z")

</div>

Yes, that’s what I meant 🙂 Casting is basically checking to see if the passed object is of the cast type. It’s a very important and useful concept, I suggest that you read up on it, it will help you greatly in any project!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b3bc4d7a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b3bc4d7a](https://forums.unrealengine.com/u/anonymous_user_b3bc4d7a)\
**Post date:** [July 2, 2021, 5:13am UTC](https://forums.unrealengine.com/t/how-to-force-an-actor-array-to-recognize-a-class/485642/8 "2021-07-02T05:13:17Z")

</div>

By using a for-each-loop that was connected to the actor array, I used a “cast to enemy” node, since the inputs allow pretty much any objects. With the cast node, I’m able to use the “As enemy” output pin to successfully run the custom input, and the code works flawlessly! Thank you Zeaf for your advice & help! 😃

![342999-code-screenshot-3.png]()

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b3bc4d7a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b3bc4d7a](https://forums.unrealengine.com/u/anonymous_user_b3bc4d7a)\
**Post date:** [July 2, 2021, 5:15am UTC](https://forums.unrealengine.com/t/how-to-force-an-actor-array-to-recognize-a-class/485642/9 "2021-07-02T05:15:09Z")

</div>

Thank you, I will! 🙂 And thanks once again for helping me!
