How do you keep the UIGridLayout size and position consistent across all devices?

Hello there, whenever I try using UIGridLayout, I can’t seem to make the elements compatible to all screen sizes while keeping the same aspect ratio AND position.

This is when I use scaling alone, as you can see it resizes and distorts the UI elements themselves, so, UIAspectRatioConstraint should fix everything, right?
Well yes it does, however, it creates a completely new problem, now the UI elements shift in position.

This is an example of what I am trying to accomplish

So, my question is, how would you be able to keep the aspect ratio WHILE keeping the same position?

I deleted my post thinking I misread, but you could try using the UiAspectRatioConstraint on the larger frame instead of the individual smaller ones.

EDIT: And I realised I can undelete my post. :stuck_out_tongue:

Sure that could work, but I don’t want it to be that way, I would like it to be so I can resize the frame however I want and keep the ratio and position the same. I saw many other places being able to accomplish that such as catalog games.

I managed to solve this on my own, no further help is needed.

can you explain how you solved it for future help please?

2 Likes

You got to put a UIAspectRatioConstraint inside the UIGridLayout, this plugin makes it a lot easier.

For scrolling frames, I opted to use a script rather than the automatic canvas size property, it works well but only if you don’t care about how many items are in each row.
If you want a select number of items each row, you got to use a script.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.