0
\$\begingroup\$

I downloaded the accordion from the unity forums and I'm trying to add a button to it. issue is with the vertical layout group. when any UI element is added the layout will automatically go vertical and scale accordingly. i fixed it by adding a layout element on the button and ticking the ignore layout option. However this generates another issue. when the UI is folded (accordion is folded) the buttons scale down and show. See image below How buttons show up when folder. these buttons are inside section 1. and when it's opened they show up as i want. accordion on Any idea on how to fix this?

\$\endgroup\$
  • 1
    \$\begingroup\$ so this does not work for you ? It looks great and simple enough to integrate. \$\endgroup\$ – Uri Popov Jun 2 '17 at 19:25
  • \$\begingroup\$ This is what im playing with right now. My issue is that when i add button inside the item it adds it to the vertical layout and scales it accordingly and I can't make anything to it. I understand this is the layout used but i want to make the flexibility of placing anything without vertical layout affection \$\endgroup\$ – David Jun 2 '17 at 19:28
  • \$\begingroup\$ For example now i want to add button under my item and vertical layout group is affecting and I can't do anything to button \$\endgroup\$ – David Jun 2 '17 at 19:32
  • \$\begingroup\$ It sounds like this question could be edited to improve it by walking us through this problem case you mentioned. Show us how you've set up your UI. Then show us how you add a button to it. Then show us what happens, and describe (or mock up / diagram) what you want to happen instead. Focusing on a specific issue like this will help attract more useful answers. \$\endgroup\$ – DMGregory Jun 2 '17 at 21:30
  • \$\begingroup\$ @DMGregory hi i edited the questions. \$\endgroup\$ – David Jun 2 '17 at 21:57
1
\$\begingroup\$

You can achieve this by adding a layout holder for your buttons that has a horizontal group layout. Note that if you want a custom group layout you will probably have to write it yourself. This screenshot shows how I set up the element. enter image description here

From there you can play with the preffered width and height of the layout element component of each button.

Hope this helps :)

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.