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 omatase · Feb 19, 2015 at 01:44 AM · uimaskscroll

Scrolling list of prefabs

I have an equip screen in a game I'm working on and will have a list of inventory displayed for the player to choose from. I'm displaying the inventory options in a list. All of the available inventory, even when filtered down, will be more than can be displayed on a single screen and so I need to make the inventory list scrollable.

I'm using the new UI controls to accomplish this and am most of the way finished implementing the solution. I have a Scroll Rect, Scroll Bar, Vertical Layout Group and Mask to achieve the affect. Each inventory item in the list is a prefab.

The only real issue I'm having is that when I add a prefab to the panel that is being scrolled and masked I can't find a way to make the panel size taller to accommodate all of the inventory item prefabs. In practical terms the problem this causes is I can only ever see as many prefabs as will fit in my panel at a static height. I would like to be able to add an indeterminate amount of inventory items to my list and have it automatically increase the scrollable area.

Is there a way to tell the Vertical Layout Group to automatically expand to meet the size of the contents? Or is there a better way to do this? Even though the mask would hide this from the user, it seems wrong to make a panel that's 20,000 pixels tall to be the height of the contents.

Here is an image attempting to show the problem I'm having. The lighter background of the prefab at the bottom indicates the one that the scroll rect won't automatically show. It can only be seen if I set the Movement Type to Elastic and pull the list away from the bottom of the ScrollRect.

Appreciate any help anyone can provide.

alt text

scrolling-prefabs.jpg (209.8 kB)
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
1
Best Answer

Answer by omatase · Feb 19, 2015 at 01:55 AM

Aaaaaaaaaand I find the answer five minutes later.

After posting the question I resumed my research and found what I think is the best solution. Here is a link to another stack overflow answering a different question. The solution, however, works for my problem as well.

http://answers.unity3d.com/questions/789561/46-ui-text-rect-does-not-expand-automatically.html

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

21 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

Related Questions

stopping scrollrect if it is about to leave the desired space 0 Answers

Masking GameObject in Canvas 1 Answer

Use a UI Mask on ParticleSystem 1 Answer

Scroll Rect in Web GL 5.4 0 Answers

Strange scrolling behavior of a native web view on iOS 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