Physics.Raycast doesn't hit anything even though Debug.DrawRay works

I’m trying to figure out if a player is on top of any platform tiles, which are made in the script from prefabs.

bool isGrounded(){
		Debug.DrawRay (transform.position, -Vector3.up * (collider2D.bounds.size.y / 2 + 0.1f), Color.red, 1000);
		RaycastHit h = new RaycastHit ();
		return Physics.Raycast (transform.position, -Vector3.up, out h, collider2D.bounds.size.y / 2 + 0.1f);
	}

Debug.DrawRay draws a ray into the platform tiles, but Physics.Raycast doesn’t seem to detect that there’s anything there.

You need to use Physics2D.Raycast to detect 2D colliders.