Instantiate Objects responsively [2D]

Hi,
so I was wondering about the best way to instantiate Objects in a responsive manner. I want to place a certain amount of objects evenly on a canvas in a way that takes the screen size of the user device into account. Think about a game of memory where all the cards are placed next each other and if there is no more screen space available it forms a new line of cards.

As I am still fairly new to unity I was just wondering whats the best thing to look at here. Grids, Canvas Scaling or smth I haven’t even thought about? I am coming form a web development background and was hoping that there is something similar to a CSS flex layout.

Thanks =)

I think what you’re looking for is the grid layout. Setup one of them with the constraint type as “flexible” and it will adjust how many elements in each row based on the screen size

Let me know if you get stuck using it :slight_smile: