Problem with raycast vertical

Hi please help me i need send raycast like a line but if drawing this ray not like a line

    Ray ray2 = new Ray(transform.position, new Vector3(transform.position.x, 50, 0));
     RaycastHit hit2;
     //Debug.DrawLine(ray2.origin, new Vector3(transform.position.x, 50, 0));
     Debug.DrawRay(transform.position, new Vector3(transform.position.x, 50, 0), Color.red);

So I think you may not be using the Ray constructor properly. You don’t need to calculate the ending location of the ray. Just the direction it should face.

Try:

Ray ray2 = new Ray(transform.position, Vector3.up);
Debug.DrawRay (ray2, Color.red)