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 Deepscorn · Nov 02, 2015 at 01:17 PM · uiunity5alphalayout

Horizontal Layout Group does not omit hidden children

Hello! I use Horizontal Layout Group component from New UI to center buttons in scene.

By default there are 2 buttons: https://www.dropbox.com/s/6w4r9ci362qpng7/%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%202015-11-02%2016.12.51.png?dl=0

But one may be hidden and another one must be centered: https://www.dropbox.com/s/p1xn28v7f4795my/%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%202015-11-02%2016.14.01.png?dl=0

The problem is that I can't get this working without making hidden button inactive. I use Canvas Group element to control visibility everywhere in the scene and when I set alpha to 0 button remains in it's position. Is there any way to enable New UI components take Canvas Group alpha into account when aligning ?

My setup is as follows:

Panel (Horizontal Layout Group; Content Size Fitter, Horizontal Fit=Min Size)

  • Button 1 (Layout Element, Min Width=some unequal width in pixels)

  • Button 2 (same as Button 1)

That setup I've taken from best of live training, from http://unity3d.com/ru/learn/tutorials/modules/beginner/live-training-archive/creating-scroll-lists-at-run-time

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
0

Answer by Deepscorn · Nov 02, 2015 at 02:23 PM

Solved with following hand-written component https://gist.github.com/Deepscorn/1321fde46659b128ddb4 Will be glad to hear your suggestions. I know, that more simple way is just to write own Horizontal Layout Group, but everything in my project is already bound to existing one, so I'll be really glad to hear any suggestions on solving the issue in another way or improving the script, that I provided

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

42 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

Related Questions

how to extend the GUILayout scrollview's function? 0 Answers

transparent RGBA PNG textures worked in 4.6, how can I get them working in Unity5? 1 Answer

How can i make this script work in a "loop"? 1 Answer

How do I layout dynamically instantiated UGUI components? 1 Answer

Setting position based on size of elements on a layout group 1 Answer


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