Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Cranke · Nov 01, 2014 at 11:55 PM · uiscaling4.6

Content Size Fitter and Anchors / UI Scaling?

Hi All,

I'm creating a complex GUI using the new uGUI in Unity4.6, but I have a question about the Content Size Fitter component.

I've been using Horizontal/Vertical Layout Group components, Layout Element components, and Content Size Fitter components to get the GUI just right, but I have a problem with UI scaling across various screen aspects.

What I'd like to have is a GUI that is proportionally the same across all screen aspects and resolutions. That is, I want the GUI to occupy the same percentage of the screen area no matter what the aspect or the resolution.

To accomplish this in uGUI, I usually just ensure that the anchors of the object are set to the four corners of the object. Unity then magically takes care of the scaling for me when things are setup this way.

... UNLESS, you have a Content Size Fitter component. When you have a Content Size Fitter, it looks like Unity just ignores the anchors and doesn't scale like I expect.

Here is an example from my Unity IDE. This is the 16x9 aspect. Everthing is great. The panel with the Content Size Fitter takes up the entire vertical space of the screen as I want.

alt text

This is the 5x4 aspect. The panel on the left scaled correctly, but the panel on the right with the Content Size Fitter didn't scale. It is now smaller than the vertical size of the screen.

alt text

Is there something I can do about this?

I really want to have a UI that scales and I really want to use the Content Size Fitter to help with layout. Can I do this?

If not, is there another approach here that I'm really supposed to be using ...

Any help would be appreciated.

5x4_aspect.png (51.6 kB)
16x9_aspect.png (31.9 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 troien · Nov 03, 2014 at 12:26 PM 0
Share

Where do you want to use the ContentSizeFitter for? Since I believe this is expected behaviour...

Since this component controls the height (or width) based on Layout (Which in turn is based on its content like the: 'Text Component', 'Layout Element', etc.) so what you basically do if you add a ContentSizeFitter is that you overwrite the height (or in your case 'H delta') value of your RectTransform.

But in your setup there is no point in doing that since you want that value to be 0...

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Freezy · Jan 19, 2015 at 09:03 PM

give this a try https://github.com/FreezyExp/uGUI-SizePerChild

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 krstrobe · Aug 16, 2016 at 05:04 PM

I think you might want to go to your main canvas, go to the canvas scaler component and set it to "Scale with screen size." Then play around with the match. for me I have to set it to 1 (all the way to the right).

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

29 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

Related Questions

IPointerClickHandler error 2 Answers

Remove Focus From InputField 2 Answers

Text blurred: uGUI 4.6 9 Answers

Set Animation curve for uGUI elements 0 Answers

ugui 4.6 Slider automatic reset 2 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