Hi,
Using 4.10.2, I’ve discovered that the blueprint nodes “Remove Item” and “Remove Index” for arrays of actors do not appear to function correctly when the array itself is iterated over in a event tick.
If you have an array of actors that are accessed and processed during an event tick, and then remove and destroy one actor in the array, you will receive errors in the PIE log after exiting, telling you the actor is still in the array and pending kill. If the array is not iterated over in the event tick, things seem to work normally.
I created a sample project with this bug: when the 2D example map is open and played, the player character creates a bunch of ledge actors which get added to an array that is iterated over in Event Tick. Pressing Q removes and destroys one actor, then closing the PIE will bring the errors in the logs to the fore. If the iteration in the Event Tick is removed, and instead pressing R is used to remove an actor, there is no problem.
I understand that this might be my error, and that in fact the Remove Item and Remove Index nodes do not remove the item or index immediately - however, I’ve not seen any documentation about this. Either way, bug or not, does anyone have any suggestions as to how to remove the actor from the array while still iterating? Or would the simplest solution be to halt the the processing in event tick for some amount of time (0.1 secs?) and resume once the actor has been removed and destroyed?
All help appreciated, and if this is a bug and more detail is needed, please ask!
Thanks.