find closest target?

Right now, I am creating a Sphere from a unit, and making it grow.
When a Player unit gets touched by it, it Echos its X,Y,Z position to a Global Vector3.
The Sphere dies after touching it’s first Player unit.

Trouble is, if the player is behind a wall, or inside a building with a door, that is far away.

If there is a Unit 3 spaces away (with a wall between them), and another unit 7 spaces away,
that is within firing range, then how do I get the Enemy to target the Obvious choice?

You need a visibility check before killing the sphere. Once the sphere hits a unit you can use a raycast from the center of the sphere to the player unity. If the raycast hits a wall it means you can’t see that unit, therefore don’t kill the sphere and continue looking for player units.