Hiya,
I am creating and attaching a camera to a GO as well as changing its’ viewport size via script but am getting quirky results. Here is the code:
var camObj : GameObject = new GameObject("camHolder");
camObj.transform.parent = gameObject.transform;
camObj.transform.localPosition = Vector3(0,175,0);
camObj.transform.Rotate(90,0,0);
var cam : Camera = camObj.AddComponent(Camera);
cam.rect = Rect(.78,.68,.98,.98);
cam.isOrthoGraphic = true;
cam.orthographicSize = 100;
The GO and camera are created just fine but the viewport rect is not setting to exactly what I am specifying. The minX and minY are setting correctly but the xMax and yMax are consistently off (1.76 and 1.66 respectively).
Does anyone have any ideas?
Thanks!
– Clint