unity raycast from screen centre 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);