Layout Group - horizontal layout new line

Hi,

I have quite a simple use case which is basically just trying to show items of the same height but with different widths in sequence. These items would be created dynamically.

I seem to notice a grid layout won’t work as it keeps elements at a fixed width and I do want the items to wrap so if there’s more items then can fit the width of the screen it goes to the second row.

Is there a simple way around it?

Thanks,

1 Like

As far as I know there is no way out of the box.
what you can do is having a vertical layout group where you spawn a horizontal layout group inside.
A custom script checks if the current Horizontal Layout Group has space for a certain item. If not, it creates another horizontal layout group and sets it as current.

1 Like

It’s a relative fair UI component no? similar to Flex box for css…