Bounds has Z value for some reason

Hi,

I am using BoxCollider2D.bounds.contains to check if there is a point contained in it but for some reason, the bounds has a Z value, even though the object it is attached to doesn’t. This is causing a lot of problems for me. Is there any way to put its Z value to zero?

107407-bounds.png

Try doing this:

Vector2 playerPosition = transform.position;

if (Collider2D.bounds.Contains(playerPosition) {
    // I dont know do something here
    //That way the bounds are 2d and so is the position
}

No, there is no way as bounds is the calculated bounding box in 3d world space. This is a duplicate question of your other question as it is still about the very same problem.