How to detect multiple objects for avoidance

Hi Everyone,
I have three 3D objects that move with A*pathing. I am testing some local avoidance code that is basically supposed to repel units from each other. The code detects surrounding units from a list and if they are too close it pushes them away. It works for two of the objects but not the other. Could anyone tell me why this doesnt work? I have the code im using below and a screenshot of my display here:
Imgur: The magic of the Internet (code works for the bottom 2 units in the picture)


public void LocalAvoidance(){
		//get drawn ray between all units
		for (int i=0; i<UnitsList.Count-1; i++) { //this iterates through my list of unit objects
		for(int y=0; y<UnitsList.Count; y++){ //this iterates again through the list to make sure we capture all objects
		
			Debug.DrawRay (UnitsList_.transform.position, UnitsList[y].transform.position - UnitsList*.transform.position);*_

* //this draws a ray from unit to unit*

_ float distance = Vector3.Distance (UnitsList*.transform.position, UnitsList[y].transform.position);
//this calculates the distance from one unit to another*
* if (distance <= 3) { //if the distance is less than 3 push the unit away*
* Vector3 direction = Vector3.zero; //creates zero vector*
direction=UnitsList*.transform.position - UnitsList[y].transform.position; //gets the direction vector*
transform.Translate(-direction6Time.deltaTime); //pushing in the opposite direction of the movement.
* }
}
}
}*_

Im thinking that the solution may be making the first for loop without the -1 after UnitList. I think i was skipping an index because of this.