Sphere Overlap Actors yields inconsistent results

Hello fellow UE devs,

I am attempting to make a function in my Game Mode that returns an empty spawn point for a local multiplayer game, however for some reason the Sphere Overlap Actors node occasionally returns an empty actor list even when there are actors that would normally overlap.

The logic is to randomly select a PlayerStart and check if there are nearby actors until we find one that is not occupied, however the Sphere Overlap Actors node yields inconsistent results, which means occasionally my characters spawn inside each other and fly into the sky.

I have tried the ‘find player start’ node in BP and the ‘choose player start’ function in C++, as well as tried to use different overlap checks such as traces and box overlaps, tried turning off and on the actor class filter, playing with the collision settings of the character and probably a few other things and have reached a point where I no longer know what to do.

Could someone please confirm what I am doing wrong here? Or if not lodge this as a bug to be fixed and provide a workaround?

Thank you :slight_smile:

To anyone else having a similar problem, this was occuring because ‘get actor location’ was not part of the execution chain due to being a pure node, and hence was generating a new random number and possibly a new actor when checking the overlap and setting the return value.

To fix this the randomly chosen location is now stored in a local variable for each loop instead :slight_smile: