• 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
6
Question by PhusionDev · Mar 09, 2015 at 05:13 AM · ui

Canvas Scaler with Vertical Layout Group and Elements Not Scaling at Runtime?

I am working on an inventory application and I am encountering a strange situation in regards to the scaling of my "product panel objects" when instantiated into the vertical layout group. If I start the application at the reference resolution (320x480) and then scale to any resolution my elements get scaled appropriately, but if I start the application at anything other than the reference resolution first, my objects wont scale inside the vertical layout group correctly. I've tried a few setups with the elements but currently they are set to stretch horizontally to fill the object. I've tried both min height and preferred height (40px)

: the objects in the vertical layout group with names and eans are generated at runtime with data from an xml file. I have added a blank prefab object in both screens to demonstrate how it should look/fill :

[started at 720x1280]

https://www.dropbox.com/s/vajmyios1oe3hwn/Screenshot%202015-03-07%2013.21.33.png?dl=0

[started at 320x480 and then scaled to 720x1280]

https://www.dropbox.com/s/4ifu2s5u9jurstm/Screenshot%202015-03-07%2013.21.56.png?dl=0

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

3 Replies

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

Answer by PhusionDev · Mar 07, 2015 at 08:23 PM

I seem to have figured it out after many attempts to adjust the layout and rects, the fix was in the code when instantiating the product panels. I simply changed the following line of code:

newProductObject.transform.SetParent(productContentPanelObject.transform)

to

newProductObject.transform.SetParent(productContentPanelObject.transform, false)

thank you Runevision (of unity) in this post for the lead! http://forum.unity3d.com/threads/scrollrect-runtime-content.263815/

Comment
Add comment · Show 10 · 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 Siyuan · Apr 10, 2015 at 06:05 PM 0
Share

Thx so much!!!! Save my life!!!

avatar image Alboz · Mar 24, 2017 at 02:40 PM 0
Share

Oh god i love you :O

avatar image Stronghammer97 · Jul 21, 2017 at 02:08 AM 0
Share

Thank you so much this saved me so much time!

avatar image darrensmith · Aug 08, 2017 at 11:10 PM 0
Share

Brilliant! Saved me hours of trying to experiment with layout settings. Thank you!!!

avatar image IVxIV · Oct 09, 2017 at 08:39 PM 0
Share

Another life saved by finding this thread - thank you!!

Show more comments
avatar image
1

Answer by Democrito · Nov 07, 2017 at 10:29 PM

One more life saved here!

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 pixelworshipco · Dec 26, 2018 at 08:26 PM

  1. years later... thank you!

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

15 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

Related Questions

Customized UnityEngine.UI and asset bundles 0 Answers

Implicit "Horizontal" Axis exceptions? 1 Answer

Disable on screen keyboard for mobile phones 1 Answer

binding properties to UI Text/Image etc 1 Answer

Multiple checkboxes with UI dropdown 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