Topic: Find Markers within Range
I want the most efficient way of returning a list of markers within a given range of a specified point. I know I could just go through the entire collection of markers and compute the distance, but thought there might be something more along the lines of the code below:
Collider[] hitColliders = Physics.OverlapSphere(position, range);
HashSet<int> nearbyObjectIds = new HashSet<int>();
List<WorldObject> nearbyObjects = new List<WorldObject>();
for (int i = 0; i < hitColliders.Length; i++)
Will iterating through all the markers currently on the map be the best way to go about it, or is there some more elegant solution?
Thanks!