Mobile Screen Orientation and Camera Aspect Ratio

Hey there, I’m trying to put together a game that runs in portrait mode on Android, but I have run into a bit of a problem, 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. I’ve messed around with camera settings to no end and have been unable to achieve a useful result. There seems to be a serious lack of documentation on this.

Set to landscape mode I am able to utilize the device as intended, but as you can see by the icons at the bottom, the phone thinks it is in landscape (which it is) and this causes several problems on top of just looking sloppy. The nature of the game requires the player to swipe from left to right, and in this mode it causes the player to constantly rub the right (top) of the screen, bringing out the android menu.
11241-screenshot_2014-07-26-23-39-42.png

In Portrait mode, I am unable to find a way to get the camera to display taller than wide. Messing with the aspect ratio has not been able to produce the desired results.
11242-screenshot_2014-07-26-23-35-39.png

Hi,

In camera settings you can set the aspect ratio of the camera itself. So you can hardcode 0.5625 (16/9) and it will fit perfectly your screen.

I’m using an ortographic camera in portrait mode and it works perfectly

Dredok

You can constrain aspect ratio to 0.5625 in your camera settings and this seems to work fine for some projects.

In my case doing the above would stop all my paper2D sprites from moving so I had to us the option above for desktop and for mobile I did the following:
Leave constrain aspect ratio “off” in your camera settings and in project settings go to Android > Maximum aspect ratio and set that to 0.5625.

Hope it helps

3 Likes

Thank you, this was really helpful in solving an issue I was having today and works in UE5.