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 moghes · Jun 27, 2016 at 11:31 PM · guiscrollviewrecttransformstretchspacing

unity3d new UI - spacing in Scrollable items does not scale proportionally.

Hello everyone,

alt text As you see 3 different screenshots with different screen resolutions, and the spacing between items scales in a non-proportional way.

I have a Scroll Rect Component attached to the parent, and the components added to the child (content) appears in the attachment. I have read about Content size fitter, Horizontal Layout Group, Scroll Rect .. etc in the documentation, and played with its parameters like Horizontal fit (true/false), the Child Force Expand .. etc also followed some tutorials which contrust the scroll just like I've done.

But still can't get the "proportional spacing" between the items, lets say 1/6 th of the width of item width, but as you see I have even wider on small resolution screens and almost touching each other on big res screens.

It might be a simple trick or I have to change all structure.. any hints please :)

Best, Vasken

questipic.jpg (139.3 kB)
Comment
Add comment · Show 2
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 iwaldrop · Jun 28, 2016 at 09:51 AM 0
Share

It's hard to tell what your structure is given what's posted, but it looks like the cards could be in containers themselves. If this is true then they could be expanded horizontally without their content being expanded, and would cause what we're seeing here.

Try deselecting Force Child Expand on the horizontal axis and removing the container (if any) of the card(s). If neither of those fix it then please add a screenshot of your hierarchy from the scrollview down to one of the cards.

Good luck!

avatar image moghes iwaldrop · Jun 29, 2016 at 11:18 PM 0
Share

@iwaldrop thanks for the hints.

I did have child UI items previously but the result was even more messy, so I made the items/cards in photoshop and they are all 1 image as you see in heirchy.

I just thought of removing Content Size Fitter, and at the end I will be given a fixed number of items, I'll scale the content manually for once, and rescale in case of adding another item later on.

Even if solves, its not the best practice.

alt text

pichierarchy1.jpg (34.7 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by adriandevera · Apr 03, 2018 at 06:24 AM

Hello I just ran into this issue. I know this is old but Im posting for anyone looking for answers.

It seems that the Scroll Rect affects the scaling in this case. To solve this you must instantiate an empty game object and set it to the Scroll Rect. Once done, you can instantiate the actual prefab and set the parent to the empty game object from earlier. This will retain the anchor positioning but not the scaling. So I scaled it down a bit by half.. heres the code!

             GameObject emptyObject = GameObject.Instantiate(blankImagePrefab, deckContainer.transform);
             GameObject element = GameObject.Instantiate(elementPrefab, emptyObject.transform);
             element.transform.localScale *= 0.5f;
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

70 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

Related Questions

Show content with scrollbar? 2 Answers

Invisible BeginScrollView thumb 0 Answers

Change Background Color of ScrollView? 2 Answers

Rect to RectTransform on overlay Canvas? 1 Answer

Putting Dictionary/List using foreach as buttons in a scroll view? 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