Here, I want to apply damage to all of enemy which is overlap with box but when I connect “apply damage” to “loop body”, it only loop once even if the length of overlap actors is 2 or more. When I do not connect “apply damage” it can run properly. What is the reason? Thank you very much!
In this picture, kill one enemy can get 20 points and there is only one text appearing.
Create an Event in the BP Enemy class (TakeDamage). Call this Event in the Loop.
Have TakeDamage apply the damage.
Pass everything to the Event you need to technically apply the damage.
Damage, PlayerController, Self
Pure functions (like GetOverlappingActors) will get executed for every pin connected to them, and under the hood, the for loop will get expanded, effectively calling the connected function on every loop, which will not give you the result that you want
Save the result of GetOverlappingActors to a temporary variable, and loop on that variable instead
Thank you, the key point has been mentioned. I think the key is that Get Overlapping Actors is a pure function that is called again at each iteration of the loop.