Making a new array after for each loop

Hi,
so there’s a problem I’m stuck in for two days now. I’m trying to make an array from the result of a branch after a for each loop. I’m trying to get the result and make a new array out of it. I’m using add unique, but the issue is the new array still contains the results that aren’t true anymore. I don’t know how to remove the older results that aren’t true anymore. I’m a beginner to unreal and I really appreciate any help.

Just clear the array before you go into this part, no?

Although, of course, I have no idea what this is doing…

image

At least, you will need two arrays to solve that.

one, containing your Actors and iterate over with the foreach loop.
And the Second, of the same type, you clear before the loop and adduniques from the results of your branching to.

if you need to use the first array after the loop, set it as copy of the second one… but clear the second one after that, to free memory :sweat_smile:

There is two arrays, that’s what I don’t get…

Thanks for the answers. So I cleared the actors array before for each loop and the result is quite weird. The final array sometimes contains the correct items and sometimes misses some items. I’ll post the result if be able to solve the issue

So I just added a remove node after branch false and removed the actors out of actor arrays(I tried this before, but it wasn’t working, and I can’t remember why)

If you just show the whole code, we can take a look. Otherwise, we’re just guessing…

here


is the picture

But it’s not, eh? What’s the condition on that branch?