How to make gun accuracy be proportional to crosshair size for my FPS game

I have a gun script for my FPS game which uses this code when the player shoots:

Vector2 accuracy = [new](http://www.google.com/search?q=new+msdn.microsoft.com) Vector2(Random.Range(-spread, spread), Random.Range(-spread, spread));
ector3 direction = cam.transform.forward + [new](http://www.google.com/search?q=new+msdn.microsoft.com) Vector3(accuracy.x, accuracy.y, 0);
if (Physics.Raycast(cam.transform.position, direction, out rayHit, range))
Debug.Log("hitsomething");

And I want the spread variable to be proportional to the crosshair size variable used here:

if (isMoving) {
currentSize = Mathf.Lerp(currentSize, maxSize, Time.deltaTime * speed);
} else {
currentSize = Mathf.Lerp(currentSize, restingSize, Time.deltaTime * speed);
}
reticle.sizeDelta = new Vector2(currentSize, currentSize);

which uses currentSize to lerp the crosshair size. However if I set the spread variable in the gun script to be the currentsize variable the gun would be extremely inaccurate because the gun spread is measured in game units and the crosshair canvas is measured in screen size in pixels.

Does anyone know the proportions to convert this spread variable to crosshair size?

Nevermind, I used camera.WorldToScreenPoint to find the point that my gun was hitting with the spread and then used Mathf.Abs on the x value of the screen point to decide the crosshair size.