Mobile Screen Orientation

I am working on a mobile game that is played in portrait view. The problem is that there seems to be no way to set the camera aspect ratio to accommodate this. The Camera is always wider than it is tall, and so by using portrait mode the game still displays as though it is 16:9 while the phone is upright, creating massive letterboxes at the top and bottom. Rotating the camera is useless as it is then impossible to frame the entire game.

Landscape

11241-screenshot_2014-07-26-23-39-42.png

Portrait

11242-screenshot_2014-07-26-23-35-39.png

Problem solved. Set the camera aspect ratio to 0.5625 (16/9).

Glad to hear this solved your problem.
Out of interest, what event do you use to capture the rotation?
And how are you handling other aspect ratios (ie other mobile devices)

My screen is fixed, so I don’t need to capture the rotation. It is always played in portrait, and always fills the screen. As for other aspect ratios, I’m locking it for now, so it just gives me letterboxes on other devices. I believe that you can however create device profiles that change the settings per device. So look into the documentation for device profiles.

There is a setting in Edit->Project Settings->Android called Orientation where you’re able to set it to: portrait, reverse portrait, sensor portrait, landscape, reverse landscape, sensor landscape, sensor or full sensor. Hope this helps someone.

2 Likes

Is there a way to set it on a per Level basis? Eg. the menu is portrait, but the game is landscape.

You can use Get Gravity node from the Game mode or Pawn for determine the screen orientation.