how to make content fit a UI panel
I have generated a variable size square mesh for a 2D board game through scripting, similar to a chess board with varying nr of squares. Now I want to put a UI around it for controls (bottom) and game stats (top), similar to Wordfeud. Target platform is a mobile device in portrait mode.
I am trying out the unity UI system. I have an overall canvas that is set to scale with the screen size, in it is a child board canvas that has a child board panel that is forced to stay square and follow the parent according this thread square panel. Now I want the scripted square game board to fit the board panel. So contrary to most applications, the panel shall not follow the content, but the content shall follow (and fill) the panel. I have made the game board a child of the panel, but I do not know how to set it to fill.
a) Is it at all possible and is using a panel as parent the right way to get a board of the right size? b) Or should I change the board generation script whereby (e.g.) the tile resolution is changed such that it matches the size of the panel? (hope not).
I have searched for hours to find an example how to set scripted content to meet a UI panel size, but so far no success.
Your answer
![](https://koobas.hobune.stream/wayback/20220612072515im_/https://answers.unity.com/themes/thub/images/avi.jpg)