public static void SetCamera(Rect position, Camera camera) { Rect rect = GUIClipUtil.Unclip(position); rect = RuntimeHandlesUtility.PointsToPixels(rect); Rect pixelRect = new Rect(rect.xMin, (float)Screen.height - rect.yMax, rect.width, rect.height); camera.pixelRect = pixelRect; Event current = Event.current; if (current.type == EventType.Repaint) { Camera.SetupCurrent(camera); } else { currentCamera = camera; } }