Keep raycast centered across resolutions

I have an empty gameObject which is a child of my Main Camera. I fire a ray cast from my gun to this object to determine where my player will shoot. This works fine when unity is not maximised.

78575-capture.png

But when I use the maximise on play button, the alignment of the crosshair goes out of sync with the position of the empty gameObject.

78576-capture2.png

Is there a way I can keep this persistent across resolutions?

Is the only reason of that object to give direction to ray? Try this line of code instead:

Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));