Raycast with tag not working.

Hello there fellow Unity developers. Im having some problems with throwing a ray and then checking if we hit a specific tag but the weird part is that it was working at first and then somehow it broke and I dont get any errors.

RaycastHit objectHit;
Vector3 fwd = climbRayCast.transform.TransformDirection(Vector3.forward);
Debug.DrawRay(climbRayCast.transform.position, fwd * 2f, Color.green);   
if (Physics.Raycast(climbRayCast.transform.position, fwd, out objectHit, 2f) && objectHit.transform.tag == "ClimbEdge")
// do my shiet
//climbRayCast is a GameObject

It works however if I remove the tag, I have checked the tag name too many times to know that it is correctly written.

I would appreciate if someone took the time and helped me out with this one :slight_smile:

What happens if you change:
objectHit.transform.tag == “ClimbEdge”

objectHit.collider.gameObject.tag == “ClimbEdge”

You might also try nesting the if/check logic for the tag inside the block to make sure the logic for tagging is running AFTER the rayCasting