Hello!
I have this layout (screenshot attached) divided in three parts. The left and right ones have a fixed size and they are stuck at the corners, all good with those.
The one in the middle takes all remaining space and holds a wildy variable amount of buttons. The buttons are contained in a grid layout group.
I’m trying to make it expand horizontally as much as needed while showing all buttons on one row, and add a second row only if there’s no more horizontal room left to expand.
But as you can see in the screenshot, the second row is added even though there’s plenty of room to have everything in one row. Even if it has only 2 buttons, the second button appears on the second row!
Grid layout group has “start axis” set to horizontal. If I understand correctly, this should accomplish what I need so what could I be doing wrong?
All paddings are set to 0.
Constraint: Fixed row count, 2. (This works as expected, never makes a third row. If I set it to 1 then it works fine, but sometimes 1 row is not enough).
I have a content size fitter, tried all possible combinations and no change at all, tried removing it and no change either.
And please note that if the container has a larger number of buttons it expands correctly (horizontally), so its not an issue of not having space.
I’ve been stuck with this for a while. I thought about adding a script to calculate user resolution and number of buttons and then change fixed row count accordingly, but seems like an unclean solution, specially if documentation says the grid can do it by itself.
Any help is welcome, thanks a lot!