I have one that uses an interface to call destroy actor in the item class.
World items (loot not collected) have a custom collision (proj settings). The GM spawns a garbage collector actor in the center of the game world (not replicated). This actor has a sphere collision with a 1cm radius, non blocking, only overlaps the custom collision.
On activation the collision is scaled up over time.
On Begin Overlap takes Hit Actor → does implement interface → Calls the destroy event.
Benefit here is you’re not storing an array then looping it. Arrays are memory eaters. Loops are fully executed in a single tick. The next tick cannot start until the loop finishes.
Say you have 1,000 actors to remove and the server tick is 30Hz (33.333ms interval). In most cases that loop will take more than a single ticks duration to finish. Essentially this increases the tick interval and will cause rubber banding and other noticeable hitches.
Expensive Loops should be done in C++.
Testing code
