Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
3
Question by CubePhysics · Jan 01, 2015 at 08:21 PM · androiduiui image

How do i make my ui elements stay the same size and position on all andorid devices?

Im making an app for android in unity and in my main menu i have 3 ui buttons and the title image. I test my app by exporting the apk onto my phone instead of using an emulator or the remote. My problem is though the ui buttons and image shrink in size and move closer to the center of the screen but they remain in the same relative position to eachother.

here is what it looks like on my PC. How do i make it so that it looks like this on almost every android device? alt text

help.jpg (470.1 kB)
Comment
Add comment · Show 4
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 gjf · Jan 01, 2015 at 04:58 PM 0
Share

look at the different canvas scaler modes

avatar image Namey5 · Jan 01, 2015 at 09:12 PM 0
Share

Change the anchor positions. I believe putting one anchor in each corresponding corner should work.

avatar image jmgek Namey5 · Mar 16 at 05:08 PM 0
Share

@Namey5 Thanks so much for your answer, can you explain a little bit more?

avatar image Namey5 jmgek · Mar 17 at 10:41 AM 0
Share

This is a very old question, and I also didn't fully have a grasp of all UGUI features. The correct way to handle responsive UI is to change your canvas scaling mode to scale with screen resolution. From there you can set a reference resolution (i.e. the resolution the UI was designed for) and everything else will scale accordingly. I would recommend using the 'Expand' scaling mode as it will make sure all UI elements fit on screen no matter the aspect ratio.

1 Reply

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by Thom Denick · Jan 02, 2015 at 12:56 AM

Namey & gjf hit it, but basically there are several ways to do this in the new Unity UI.

  1. If you move your Canvas to World Space, your UI will render the same no matter the resolution. If you are concerned about pixel perfect GUIs, this is not a desirable option as you need to have high-res assets to look good on all devices. Find this setting on the main Canvas script.

  2. If you want the items to stay pixel perfect for clean edges, then Canvas Scaler is probably what you want. This is on the default Canvas object. Change the UI Scale Mode to a desirable pixels per unit.

  3. As an alternative to World Space (this might be less confusing depending on how your GUI works), you can use anchoring positions as Namey suggests.

Comment
Add comment · Show 3 · 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 Ikun · Aug 18, 2016 at 06:33 PM 0
Share

Thank you. This worked for me.

avatar image Orr10c · Sep 10, 2017 at 06:47 PM 0
Share

Thank you very much! you helped me as well. (even if it was a long time ago :) )

avatar image jmgek · Mar 16 at 05:09 PM 0
Share

Do you have any more info on 3? We can't switch our canvas to world pos, and there's little info on actually handling dynamic (responsive) scaling.

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

7 People are following this question.

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

Related Questions

Scaling resolution for Mobile devices using UI elements 1 Answer

OnDrag OnPointerDown OnPointerUp does not work 1 Answer

Use different sprites in new Unity UI for SD vs HD 2 Answers

Maintain equal physics over different UI sizes? 2 Answers

UIButtons and UITexts are on the good position when I run the app with Remote4 but when I install .apk it's totoally different. How to solve it? 1 Answer


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