Scaling frames using UISizeConstraint in a UIGridLayout

Okay I found the problem, you have a UIGridLayout, but you have the CellSize as 0,0 and you have UISizeConstraint in Each frame to force that size.

UISizeConstraint only uses pixels (offset) so it doesn’t scale with the screen resolution

Edit: I’m changing it now

Okay I’ve reviewed it, so what you are doing is kind of hacky but achieves an interesting effect.

The way UIGridLayouts work, is you set the cell size and it makes each sibling that size and automatically positions them (it uses scale and offset)

What you are doing is using UIGridLayout with a cell size of 0,0 but bypassing the fact that it be 0 pixels with a UISizeConstraint (which is only offset)

To the best of my knowledge, what you would have to do is:

  • not use UIGridLayout, and instead manually position them. That way you can use scale on the frames.

  • Or if you wanted you could script the UISizeConstraint would change based on the screen resolution.

  • If you are creating an inventory where the player can have any number of weapons (aka you can’t manually position them) it would probably be best to make a script that positions the frames based on the location of the previous frame (basically doing what UIGridLayout does without UIGridLayout). This is probably the best option and shouldn’t be too difficult.

Whatever you do, remember to use scale when positioning and sizing the frames.

P.s. maybe someone else knows some other hack to make it easier but that’s all I know

1 Like

Ah that’s unfortunate but I am capable of scripting that. Thanks!

1 Like