Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Grid with flexible width and number of columns based on screen width

Discussion in 'UGUI & TextMesh Pro' started by legoesbenr, Nov 3, 2023.

  1. legoesbenr

    legoesbenr

    Joined:
    Apr 27, 2022
    Posts:
    10
    I'm pretty new to Unity UI and trying to wrap my head around making a grid with flexible optimal width.
    Our experience runs on both phones and desktop, so we experience very differentiating screen widths.

    I want to set the minimum AND maximum width on the cells and then the grid should adapt the number of columns based on adapting the cell width to the screen width.
    So; if there cell width go below the minimmum width, then the number of columns are reduced and if the cell width go beyond the maximum width, then one more column is added.

    So a grid that is flexible on column number and within min/max cell width, to optimize the full grid width.

    How do I configure the Grid Layout to do that?