ForEachloop Returning Only One Element?

Hi There,

I’m having difficulty understanding something when using ForEachLoops.

I’m trying to build my SaveGame system using blueprints and I want to add all my spawned actors into a class array. What I am using is a “Get All Actors of Class” node connected to a “ForEachLoop” to loop through all the actors of said class in the level and Add them to the Array.

My problem is that for testing I have added 3 of said actors and when debugging by plugging a PrintString with LENGTH directly into the “Get All Actors of Class” I get 3 results which is correct, but when plugging the PrintString into the “ForEachLoop” it always only picks up 1?

I would like to add all the spawned actors of class into an array so that when I save my game they have their individual values that can be loaded back again, but as it is currently it only saves the values of 1 actor.

Am I missing something?

Ok never mind, I found the problem. In my sequence node I added a 16th pin which would go to the next set of nodes in the blueprint and would do so the first time the loop went through the actors, resulting in only 1 hit. Removing this pin and only when the loop completed would it go through to the next part of the blueprint resulting in all actors in the level being detected.

It’s always the little things that causes the biggest headaches amirite? :stuck_out_tongue: