# For Each Loop Array not compatible with actor reference 

**URL:** <https://forums.unrealengine.com/t/for-each-loop-array-not-compatible-with-actor-reference/2498103>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [May 9, 2025, 2:00am UTC](https://forums.unrealengine.com/t/for-each-loop-array-not-compatible-with-actor-reference/2498103 "2025-05-09T02:00:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skullbuster1220](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skullbuster1220](https://forums.unrealengine.com/u/Skullbuster1220)\
**Post date:** [May 9, 2025, 2:00am UTC](https://forums.unrealengine.com/t/for-each-loop-array-not-compatible-with-actor-reference/2498103/1 "2025-05-09T02:00:02Z")

</div>

So Im making a turn based combat system, when combat starts a sphere collider detects every actor in the radius and if they are of a certain class they get added to an array, but for some reason, it stopped working, it worked before but now its telling me an actor reference is not compatible with the character reference? I dont know if this is a bug or if I messed something up

 ![Screenshot 2025-05-08 210224](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/d/0/0d01c525d8d9b342a8e1f80ac236829b28ad8f81.png)  
 ![Screenshot 2025-05-08 214024](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/f/82f656eaef113661c6f4e87e95c2c83f6b2db308.png)  
 ![Screenshot 2025-05-08 214136](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/2/b/22b557dc7e8a96b39438533a9a99bb78a4232983.png)  
 ![Screenshot 2025-05-08 214154](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/7/4/37455e8f8c3d226550bc005b297740f3f1949c1a.png)

---

<div class="post-metadata">

**Author:** ![lordlolek](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lordlolek/32/906205_2.png) [@lordlolek](https://forums.unrealengine.com/u/lordlolek)\
**Post date:** [May 9, 2025, 6:44am UTC](https://forums.unrealengine.com/t/for-each-loop-array-not-compatible-with-actor-reference/2498103/2 "2025-05-09T06:44:46Z")

</div>

Probably your Battle Actors array is not actually array of actors but BP\_Character\_Base.  
You can either change your array to be an array of actors, or cast your actor to BP Character before adding it to an Array, like so:

 ![obraz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/1/2/212da30b7d083d2b1f0e4b72519b87dc1481734b.png)

---

<div class="post-metadata">

**Author:** ![Skullbuster1220](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skullbuster1220](https://forums.unrealengine.com/u/Skullbuster1220)\
**Post date:** [May 9, 2025, 2:57pm UTC](https://forums.unrealengine.com/t/for-each-loop-array-not-compatible-with-actor-reference/2498103/3 "2025-05-09T14:57:54Z")

</div>

That seemed to do the trick, thank you
