This is indeed a frustrating limitation. Why is there no backwards loop? Or a way to invert an array?
Delays and MarkForDestruction work fine for handling delayed destruction of the object itself but I think it could be confusing if the actor than refers back to the array (which is presumably held elsewhere) to remove itself. Hmm… you probably mean a delay calling Remove on the array. Still seems confusing.
Other suggestions:
- Use a while loop instead and increment the index manually whenever no item is removed.
- Set up a reversed ForEach loop as suggested in this post: Reverse For Each Loop Macro with Wildcard Code - Audio - Epic Developer Community Forums
- Add the to-be-destroyed actors to a second local array. After your ForEach loop has completed, iterate through the helper array but destroy the actors in your main array.
Good luck!