Unity how to cast a ray from the center of screen to world 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);