Fitting camera width to specific scene width

Say my scene is laid out in a flat 2D grid (basically, tiled). My camera is up above and looking mostly down, with a perspective view. It’s as if you are walking down a hallway looking at a point in front of your feet.

Suppose the part of the scene I’m interested in (the hallway) is 10 tiles wide, and an arbitrary number of tiles forward. I would like my camera view to fit the 10 tiles width across the horizontal view of the camera, and let the vertical view of the camera show as many tiles forward/backward as the aspect ratio allows.

I can control how many tiles wide the view is by raising and lowering the camera, for a fixed aspect ratio. However, when the aspect ratio changes (e.g. resizing the game view), this affects the number of tiles seen horizontally across the camera view. I would like to keep that constant.

How is this typically accomplished in Unity?

You can find the math here:

http://docs.unity3d.com/Manual/FrustumSizeAtDistance.html

So the calculation will be:

 var height = desiredWidth * camera.aspect;
 var camera.fieldOfView = 2.0 * Mathf.Atan(height * 0.5 / distance) * Mathf.Rad2Deg;

Note that ‘distance’ is measured out the forward of the camera (regardless if there is something there), not the distance between the camera and your tiles.