Get Overlapping Actors dont return all actors

The Blueprint and Picture should speak for it self … The OnPickedUp function just calls Destroy Actor …

I Pickup this Items on spacebar press. The Pickup itself is working but I dont pick up all Items in range.
The ingame Screenshot show a much too big Box Collision(its almost bigger than the level itself to ensure all items are in) … all Items are within it!
Now when i hit spacebar some items dissapear BUT NOT ALL
they dissapear in a distinct order and i can make them all dissapear by just hitting space a few times and i dont even have to move so the Box isnt moving.

I dont get why they are not found all in the first spacebar press … Am I missing something on this simple blueprint ?

Hi L1ne,

Thank you for the report. I was easily able to reproduce the issue so I have created JIRA report UE-13672. Our developers will be investigating it further and we will post back here with updates as we have them.

As a workaround, I noticed that if you add the overlapped actors to an Array then loop through that array, it will work correctly.

Let me know if that works for you.



Works now with the array.



I’ve been working with one of our devs on this and he explained that this is a common misunderstanding and the expected behavior of the GetOverlappingActors array.

The array that’s created by the GetOverlappingActors node isn’t ‘set’ like a standard array. The size can be changed each time a ForEachLoop is iterated. Because of this, with each loop the array size changes leaving behind some of the overlapped objects. This is a little hard to explain in just text so if you would like me to go into further detail, just let me know.

Anyways, the workaround that I gave you isn’t a workaround, it is actually the correct way to implement this.



1 Like

I would very much like to hear more details about this! I assume it applies to all functions that have an output TArray parameter? In what case would this array be changed as you loop over it?

This is inconsistent behavior and not documented clearly, how is this a Non issue?

1 Like

Reporting, this workaround doesn’t work when I use SphereOvrelapActors in a AnimNotify. It works only in an Actor.

Can I just say(If I can) thank you for the workaround and I have some info on it that could help(if it’s not too late). I noticed that it’s specifically half the actors getting missed, and it only happened for me when the mobility of the actor was set to moveable, thanks and I hope the info helps!

I just came across this issue today and luckily the workaround works :slight_smile:
Just for the better context: the easiest way to explain such behaviour is that the “GetOverlappingActors” is a Pure function, that means it is (probably) called every for loop iteration. So the “workaround” is not workaround but a valid way of handling it. First - copy the result to local array and then work on that copy without calling “GetOverlappingActors” every time.