Raycasting in a 2D Environment - C#

Currently, I am programming a 2D Platformer and need to get the Player to be able to jump. Right now, the jumping works well, and so I have moved on to preventing the player jumping whilst in the air. I have used raycasting before and usually, it works well, but I have never tried using it in the 2D version. I am using C#, and would appreciate any help that is given. This is my code so far:

RaycastHit hit;
		Ray groundingRay = new Ray(transform.position, -transform.up);

		Debug.DrawRay(transform.position, -transform.up * jumpRayLength, Color.blue);

		if(Physics.Raycast(groundingRay, out hit, jumpRayLength)) {
			if(hit.collider.tag == "Ground") {
				isGrounded = true;
				isJumping = false;
			}

The Problem, that I have found, is that it is not registering colliding with another GameObject. Please note that I have checked that the target object IS tagged.

the simplest answer is to ‘pretend’ that your 2d objects are 3d. (i.e. give them box colliders with a little thickness)

You are likely using objects whose colliders are too thin for a raycasthit to register.

(Let us know if this is not the case though, and i’ll look into an alternative).