- Home /
Fit screen size
I'm developing a simple game and reached the building stage. The camera works well when I use 9:16 aspect (Image 1). However, when I change it to another screen size (1920x1080), it displays everything outside the game scene (Image 2). Any advice or solution for me to keep the display always like 9:16 or make it fit on any screen size?
Answer by AaronBacon · Aug 17, 2021 at 01:16 PM
Your best bet is probably just messing with the settings under Edit>Project Settings>Player> Resolution and Presentation: Make sure you swap to the Android Tab if this is meant to be run on phones. But anyway, through there you can mostly restrict what resolutions the built game runs at so that it'll force the game to run at resolution you know it works at. I'd say turn off "Default is Native Resolution" and have it run at a ratio you know it works at.
One other thing that might help is the Canvas Scaler component, you can make UI scale with screen size:
Answer by Vivien_Lynn · Aug 17, 2021 at 01:33 PM
I usually use a customized version of an AspectRatioEnforcer you can find here: http://wiki.unity3d.com/index.php/AspectRatioEnforcer
You define your aspect ratio (9/16 = 0.5625) and the script will add pillar boxes (black bars left and right), and letter boxes (black bars top and bottom), to hide everything outside of your desired aspect ratio.
(In case the web page looks as broken to you as it does for me, go to this link http://wiki.unity3d.com/index.php/Main_Page, and in the top right search bar type AspectRatioEnforcer.)
Your answer
Follow this Question
Related Questions
Camera Fit Issues on 10 inch tablet 0 Answers
How to force the game to be stretched to fit the screen? 1 Answer
How do i place borders and sprites on camera edges? 0 Answers
Custom aspect ratio in build 0 Answers
VR mirror view custom size and FoV 0 Answers