unity raycast screen center code example
Example: raycast from center
Transform cam = Camera.main.gameObject.transform;
Ray ray = new Ray(cam.position, cam.forward);
Transform cam = Camera.main.gameObject.transform;
Ray ray = new Ray(cam.position, cam.forward);