GetComponentInChildren is finding the parent ?

So my problem is simple, Im trying to access the children collider, but when printing the retrieved collider gameobject name (which should be “Leg”) I get the parent gameobject name printed instead of the children name. Meaning im failing to access the children collider.

public class JumpPlayer : MonoBehaviour {

    Collider2D playerCollider;
    Rigidbody2D rbody;
    Collider2D childCol;

    float maxSpringHeight = 2.4f;

	// Use this for initialization
	void Start () {
        playerCollider = GetComponent<Collider2D>();
        childCol = GetComponentInChildren<Collider2D>();
        rbody = GetComponent<Rigidbody2D>();

Im not sure if Im doing it wrong or if I should use another function to access the child collider. Thanks in advance

GetComponentInChildren returns first component of that type found. It also checks the object you are using it on.

If you know for sure which child will have this collider then you could just reference it directly in editor. Else you could do something like this:

childCol = GetComponentsInChildren<Collider2D>().FirstOrDefault(x => x.gameObject != this.gameObject);