Using a Function from an actor to all those actors inside an overlap.

This building is a Combination of actors from a single class and

You can see there is an overlap Actor that counts how many of those are destroyed(As I call them in bp as death) they are not getting destroyed as in Destroy actor.

What I am trying to do, is to use Begin Death for all the actors that are overlapping only. My code works fine but only for the actors from index 1 to something and leaves the rest of it out.

Hi @IBilalijaz

As this is a loop through an array, and as long as youbare not modifying the array during this routine, then ALL indexes should be evaulated.

Therefore i would put a print node on the check for overlapping actor. And output the boolean value, and count up make sure they are all correct. My guess is some you expect to be overlapping are infact not.

Just a thought anyway. Learning to debug is essential for coding so start at the beginning then check each stage until you find the issue.

Print statements are good for this as long as theres not too many. But you could also use a counter to count how many are overlapping and output that at the end so you can check if its correct

Yeah Well I find a solution, if anyone is looking for it, If you have a box collision and you have multiple actors inside that. You have to Find nearset actor of the class as in my case is build count. When you do that, my exact code works perfectly fine as it will only work for those who are overlapping. it might not be the best solution, but its good.

1 Like