I’m trying to automatically scale the CellSize of a UIGridLayout to stay within the boundaries of the frame but to also display the new rows and columns added. This is what I have so far:
nevermind i dont think im right. i think i misunderstood your problem anyways
say there are n items in a grid. then there are n-1 paddings. we are working on the horizontal axis. lets also work in scale for ease. im also assuming the padding is not included at the end (p sure it isnt but i forgot).
(n-1)p + nx = 1, where x is the x size of the item. scale has no unit since its offset (pixels) divided by the viewportsize (pixels), so lets just call it scalards or something idfk. we know the sum of the paddings and each cells size is 1 scalard. we know n- it’s the number of columns. but do we know x, the size of each ui? i dont think there’s a way to separate the variables p and x (maybe im overisghting), but what you CAN do is vary the size of the X as the number of items increases. say 0.08 scalards to 0.07 to 0.06. then you can calculate the padding for items sized of that grid.
scale’s better anyways. do you need the UI to be in offset? offset just keeps it a constant size in pixels. scale changes with the viewportsize, that is the window size of the game client.