unreal engine ForEach Loop Only Fires Once

Hello everyone, can someone tell me why the ForEachloop only runs once? If you look at the “Give Items” variable in debug mode, then there is definitely more than one element in it.

EDIT: The actor spawn occurs once, and if, for example, you add “print String”, the message will fire as many times as there are elements in the array

thank you in advance!

Hey there @kaktic_c! Sounds like the issue is with the spawning then. Can you change the Collision handling override to Always Spawn, Ignore Collisions?

Hi, Thanks for the answer, I also thought maybe that’s the problem, but it’s not

interestingly, if you add “print String” before “Spawn actor” and track the execution of the code, then “print String” will work for example 3 times, and “Spawn actor” only once. Unreal engine does not issue any errors.

If this prints once:

I also thought maybe that’s the problem, but it’s not

It very much does so, though - judging by the description. Set the actor’s components to No Collision for now - see if that actually helps.

1 Like

(post deleted by author)

Thank you very much, it helped