What I'd do is throw all your enemies into an Array that you want to try to lock onto. Then whenever the player tries to lock on, use the Array List Get Closest Game Object with the player as the target to check against. From there you should be able to then check distance to see if they are close enough to be allowed to lock on as well as switch to the next one in the array.