How Do I Find The Closest Entity

So uhh i am making a game and it contains some bots
they currently use a for all entities between positions every tick to find an item
i was wondering if theres a way to find the closest entity in a simpler way than brute force
is there a solution?

1 Like