Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Gng357 · Nov 20, 2018 at 10:35 AM · scalesizebackground

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 cutoff

  • using Expand I get "black bars".

  • using Match Width Or Height with Match: 1, I get "black bars" or Match: 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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Gng357 · Nov 20, 2018 at 02:29 PM 0
Share

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?

avatar image Casiell Gng357 · Nov 28, 2018 at 01:34 PM 0
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

95 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges