Raycast and ScreenPointToRay

Before I ask the question, I would like to thank you for taking the time out to look over my query.

Ok, so I’m currently being challenged with this feature I’d like to add into my project. It’s not something I’ve done before, and I’ve exhausted all of the ideas I had. What I’d like to do is to cast a bunch of raycast from an point near the center of the screen until the end of the screen, and which ever hits first, I’ll stop the loop there.
I’ve created an image to better display what I want. I will also run try to run through it in more detail.

Ok, so the green lines will be our center of the screen, and the buildings are there for raycasting examples.
I’d like to cast the first ray from the big red dot on the green line, and if that doesnt it, we cast a ray on the second red dot. So it would be casting rays from Left to Right. And it will continue to do so until the last red dot (if nothing was hit prior).

I’ve tried doing a loop of raycasts and subtracting the ScreenPointToRay by (i * number) to create those dots, but I didn’t get too far, as it quickly got too complex as I expected it would.

Regardless, I’m hoping one of you can help me out with this problem. And thank you again for reading my post, I really appreciate it.

I think you can try to do it this way:

bool objectHit = false;
GameObject obj;

for (int i = 0; i < Screen.width / 2; i+=20)   // 20 pixels between each dot
Vector3 coord = new Vector2(i, Screen.height/2, 0);
Ray ray = Camera.main.ScreenPointToRay(coord);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
   obj = hit.transform.gameObject;

if (objectHit) Debug.Log("Object hit");
else Debug.Log("No object found");