- Home /
How to merge two cells from a Grid Layout Group
Hello,
I have a list of buttons within a Grid Layout Group. Buttons are added dynamically with a name, the length of the name is restricted and fits in one cell.
For the case when text is longer, I want to merge two cells and the text can be displayed properly.
One solution I tried. Supposing my grid contains cells of size 2 * a, I align buttons of size a (i.e. can allocate two elements), but this solutions seems super hacky and aligning spaces between elements within the cell should rely on image dimensions.
I prefer to keep my grid with cells of size a, alignment is up to the Layout group and when text is larger, merge two cells. How would it be possible to merge those?
Thanks in advance
Did you ever figure out how to do this? I checked out the Flow Layout group Brogan suggested but it didn't seem to easily merge cells.
Answer by Brogan89 · Jun 09, 2017 at 12:07 AM
Unity UI out of the box is pretty weak. If you go here https://bitbucket.org/ddreaper/unity-ui-extensions your life will change
Thank you for pointing that out. $$anonymous$$ight be the solution, I will have to get an approval for this solution to go through, in the meantime, can you be a bit more concrete with an example that uses the Grid Layout, which is our only concern at this point? Regards
I haven't used FlowLayoutGroup yet, nor have I got much experience with Unity.UI.Extensions because I recently stumbled across it myself. But our UI designer is loving it, so that's a good sign lol. I would start here https://bitbucket.org/ddreaper/unity-ui-extensions/wiki/Controls/FlowLayoutGroup. Its a far more flexible and dynamic version of the GripLayoutGroup
Your answer
Follow this Question
Related Questions
Create a object in front of the player 1 Answer
Multiple Cars not working 1 Answer
UI Only Updates As Intended When Editing Through Scene 0 Answers
Object coordinates not updating as expected 0 Answers
Distribute terrain in zones 3 Answers