gameObject comparison

if(other.transform.position == brickList[r].transform.position)

other is a Collider object while brickList is an array of gameobjects but in different position… i want to know the index of other in the array…

but the if statement never returns true.

A possible cause (aside from “the position is not in the array”) for this might be floatingpoint inaccuracy (a.k.a. the bane of gamedevelopers). What you could do, is try and compare the distance between the positions with a very small number to check if the positions are at least very close together if not equal.

if((other.transform.position - brickList[r].transform.position).magnitude <= .01f)
{
    // do something
}