Raycast between two objects but keep going

I have the below code which draws a ray between two objects. However, I don’t want it to stop at the destination object but instead keep going. How can I accomplish this?

        Vector3 dir = crosshair.transform.position - crosshairPoint.transform.position;
        Debug.DrawRay(crosshairPoint.transform.position, dir);

Debug.DrawRay needs definite length. You set the length by multiplying the direction vector (in unit length) by the needed length but the length cannot be infinite (as opposed to the Raycast where it is ok).

Just set the length value large enough to suit you purpose (I’m pretty sure you will not make out the end of that ray if the length value is large enough)… so something like this:

Vector3 dir = (crosshair.transform.position - crosshairPoint.transform.position).normalized * 10000f;