Hello
In the game I am working on we have both horizontal and vertical based levels. I want to be able to switch the camera's setup so that it displays horizontally on iOS when on a horizontal level but set it in portrait mode when on a vertical level. I am sure its simple to do this but I am obviously missing something. The horizontal setup works fine but that could be because most of the game is in horizontal. When the vertical code runs everything is rendered vertically (so portrait on the device) but it has massive pillar boxing going on. I'd post a screenshot but I can't, sorry. Hope I have explained it well enough.
public static void SwitchCameraTo(Orientation orientation)
{
// If the orientation is already correct, return early
if (orientation == GameController.CameraOrientation)
return;
GameController.CameraOrientation = orientation;
if (orientation == Orientation.Horizontal)
{
GameController.Camera.nativeResolutionWidth = 960;
GameController.Camera.nativeResolutionHeight = 640;
GameController.Camera.forceResolution = new Vector2(960, 640);
Screen.orientation = ScreenOrientation.LandscapeLeft;
}
else
{
GameController.Camera.nativeResolutionWidth = 640;
GameController.Camera.nativeResolutionHeight = 960;
GameController.Camera.forceResolution = new Vector2(640, 960);
Screen.orientation = ScreenOrientation.Portrait;
}
}