How to get nearest actor?

I want actors to get actors at a certain distance, or position.
I think i could do that if i could make actors get the nearest actors to them(and have their references?).
How can i do that?
Actors can be of the same or of a different class.

you can use SphereOverlapActors to poll the Actors nearby.

You may also want to use a collision Component and register overlapping Actors with the ComponentBeginOverlap and deregister them with ComponentEndOverlap. (this is the better method imo)

After you got the nearby actors, you can iteratore over them and check the distance to everyone. use Min(actorDistance,currentActorDistance) and if currentActorDistance < actorDistance save the Actor.

Thanks a lot!