- Home /
Scaling for all Aspect Ratios for all Android mobile devices
I am new to Unity and I have this "issue".
I am trying to make a simple 2D mobile game (Android for now) that will be in portrait mode always but I don't manage to have the same result in all different screen sizes.
The problem is when I am trying to have the screen scaled equally in all different screen sizes, but what I get is the background cutoff either on top-bottom or left-right (I know that has to do with the Match Width Or Height
) when I am trying to change screen size.
So what I am using in Canvas Scaler: Scale With Screen Size
with Reference Resolution X:1080 Y:1920
and a background image of size 1080x1920.
When I try to resize to larger screen resolution (for example 1080 x 2160):
using
Shrink
the background is cutoffusing
Expand
I get "black bars".using
Match Width Or Height
withMatch: 1
, I get "black bars" orMatch: 0
, the background is cutoff on the sides.
OR also when resizing to smaller ratio (3:4) I get either black bars or background cutoff on the sides.
All of the 16:9 (576x1024, 720x1280, 1080x1920, 1440x2560, etc) seems to be correct.
So my question is, in which way I can support all different mobile screen sizes including all different aspect ratios without getting my background cutoff or getting the black bars on the sides?
Thanks in advance.
Answer by Casiell · Nov 20, 2018 at 01:58 PM
The only other way, your background would be squished and (depending on the background) could look ugly. What you need to do is change anchors on your background, so it always stretches to full canvas.
Hello Casiell and thank you for you reply. This is what I end up doing. For now it's okay because the current background is only 2 colors so it's difficult to see the stretching. But is this the only way to do this? Isn't there a way that Unity deals with this situations?
There is not really a way to have a single image work with multiple aspect ratios without stretching or cutting parts of it. You can have multiple images for multiple aspect ratios and switch between them in runtime
Your answer
![](https://koobas.hobune.stream/wayback/20220612182440im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Images in games 1 Answer
Scaling down models 2 Answers
Scale script don´t work 0 Answers
How do you change size of an object by its units rather than scale? 1 Answer
Standard Sizes for player 3 Answers