How to implement a Grid LayoutGroup with elements of different sizes?

I was wondering how to implement a grid layoutgroup with these types of elements?

Unity’s built-in Grid Layout Group can’t do that. You’d either need to lay out your grid by hand or write your own component.

If you want to write your own component, then you need to describe mathematically what the inputs look like and what it should do with them. For instance, how does it know what size and shape each box should be, and how does it decide which box to put where? What does it do if the sum of all boxes is larger or smaller than the available space?

Your picture looks to me like it was probably laid out manually by a human being, rather than automatically by an algorithm. (Not that one couldn’t write an algorithm that would produce that output given some input, but it looks “fine-tuned” to me in a way that’s not representative of most algorithmic output.)

I figured it wasn’t there by default, but was wondering if anyone had any creative solutions before I write my own custom layout. It will be laid out based on a semi-random algorithm, which our designers are coming up with.

@SimonDarksideJ In the past, we’ve looked at your Unity UI Extensions repository for extending Unity’s UI due to Unity’s rampant issues with their UI. Do you know if your repository has anything that would handle this? I saw a FlowLayoutGroup component, but wasn’t sure if it’d cover this case. Thanks.