• 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 rounix_unity · Feb 28, 2020 at 01:20 AM · uiscaling

UI does not scale and is eaten by a screen

Hi, i am trying to find a solution to this problem for nearly 4 hours and i have no idea what is wrong.

So what i am trying to do is to scale my ui down so it looks nice on every or most resolutions. However i cannot get it to work, even tho i did before.

Here is a screenshot when im using a Free Aspect mode: alt text

And here is a screenshot of my ui after i use 5:4 resolution:

alt text

As you can see everything is messed up. Every button on both of those screens is in a grid layout group(besides Text). As you can see, one that is organized vertically scales perfectly fine, but everything else is not, and i have no idea why (they are both under the same parent).

My canvas is set to scale with screen size, with match set to 0.5. All of the objects here are organized using pivots (their position is set to 0 as you can see on the second screen). I have no idea what can be wrong. Any help is appreciated.

pbrane1.png (13.4 kB)
pbran2.png (279.2 kB)
Comment
Add comment · Show 1
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 kskjadav007 · Feb 28, 2020 at 09:14 AM 0
Share

link text

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by smillyfaces · Feb 28, 2020 at 02:20 AM

perhaps you could change the position of the UI through script?

Comment
Add comment · Show 1 · 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 rounix_unity · Feb 28, 2020 at 09:00 AM 0
Share

Can you send me a link to the docs? i cant seem to find it anywhere

avatar image
1

Answer by JaredHD · Mar 05, 2020 at 10:32 PM

I saw your comment on one of my old questions.

I don't remember the video or that solution but I can give you the solution I use now a days.

Make sure your cavas scaler match option is set to 0.5 and you've set the reference resolution correctly.


I usually use Grid Layout Group to set up the layout in the editor. I then disable it. If you want a more dynamic option you'll have to mess around.

I then set the anchor of every button or panel or object to their 4 corners. I use this script to do it.



Just place it in a Folder called "Editor", without quotes. Then select the object or objects you want to align the anchors with and then press ctrl+[ to set the anchors to the corners.

ctrl+] will shape the object to the anchors which can sometimes cause unwanted side effects because you can't undo with ctrl+z.

And once the anchors are set you are ready to go. You can scale it in any direction and it should scale to the screen.

I have no idea if this is the correct method, but I find that no matter what the resolution, the objects will scale correctly.

Hope that helps.

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

Answer by Natrad · Jan 14, 2021 at 05:06 AM

Hi, For UI elements, with your purpose, you should do like this:

  1. Calculation Ratio of Your device Screen Size (Resolution)

  2. Coding to re-generate your UI element Size & Position follow the DESIGNED Canvas and REAL device Screen Size.

Rrgs,

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

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

Related Questions

Weird Scaling in Grid Layout 2 Answers

UI Scaling with Button Text 1 Answer

How would i go about having a UI text element that becomes larger and smaller based on how close or far the player is? 0 Answers

UI scaling too big after build 0 Answers

UI on mobile - squashed font? 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