• 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 jo000408 · Jul 01, 2018 at 12:36 AM · androidscreen sizeaspect

Android Relative Screen Size / Aspect?

I almost finished my game for android and while developing it I always tested it on my phone that has a 1920x1080 pixels screen and it worked perfectly. Now that it is almost done I tested it on another phone that only has a 1280x720 pixels screen and you can only see a section of the game (a part that would normally be in the middle of the screen). I know that you can change the aspect in unity (it is currently set to 1920x1080 for me) and I also know that you can make a canvas relative or absolute. But if I change the screen size / aspect from my current setting to 16:9 all the buttons are somewhere else in relation to the screen than they were before. Is there a way to fix this problem without having to move every button, camera etc. individually to the position I want it to be? (and so that they are at the same position on every phone regardless of the amount of pixels the screen has)

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 CardboardComputers · Jul 01, 2018 at 05:17 AM

The short answer is, no, there are always some problems with screen sizes and aspect ratios. Unless you want things to scale up and down, possibly including stretched text/icons (which is generally not recommended at all), there's not much you can do about that. Some minor text and icon stretching is usually acceptable, but you might not want to rely on it, since there are way too many different aspect ratios and resolutions. Instead, the best you can do is hope your user has a pretty normal-looking screen, and

  1. Play around with the Canvas and Aspect Ratio Fitter settings.

  2. 9-slice your buttons and other UI elements so that they don't look too stretched, even if they are.

  3. Anchor your UI elements correctly. If you have a dialog with an "OK" button on the bottom left and a "Cancel" button on the bottom right, then anchor your "OK" button to the bottom left of the container and the "Cancel" button to the bottom right of the container.

  4. Concerning the previous point, you may also want to move their pivots to the bottom left and bottom right, respectively, depending on your intentions. If you're not messing with their rotations, you can probably go ahead and do that.


Those last two are probably most important for keeping your buttons in the right places. Since the screen will resize, it won't be in exactly the same place, but something that's supposed to be at the top will still be at the top, and something that's in the corner will still be in the same corner. The general idea is to keep pixel offsets to a minimum, so changes in pixel count won't significantly affect the appearance.

Comment
Add comment · 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

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

197 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Make Objects spawn within different screen sizes 0 Answers

Change main camera size depending on screen size 1 Answer

How to Force small Screen size on (x)large Android screen ? 0 Answers

camera and screen is much farther out on android build? 0 Answers

multiple apks to match certain devices 0 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