GuiObject relative size constraint

Right now, if you want a gui to be sized relative to another gui you need it to be a child of that gui, or at least a descendant with a traceable scaling multiplier back up to the gui you want to scale relative to.

This is obviously super annoying and constrains the way developers can organize their interface hierarchies. So my suggestion is a ui constraint that allows me to declare a relative sizing target. Once declared, the gui’s size will be calculated relative to that target object instead of the gui’s immediate parent.

Example API:

Class UIScalingConstraint : UIConstraint
   Property <Class>GuiBase2d UIScalingConstraint.Reference

With the following hierarchy: FrameB will scale relative to FrameA instead of relative to ScreenGui

ScreenGui
┣ FrameA
┗ FrameB
  ┗ UIScalingConstraint (.Reference = FrameA)
16 Likes

In cases where I’ve wanted something like this, I have wanted to align different aspects of position and size with more than just one object. My typical case is that I have a horizontal rectangle card. In it, there is a square image on the left, and on the right is something that fills the remaining space with a textlabel. Is there a way that I could use the proposed feature to get the desired result in my case?

If not, do you have a usecase intended for this feature request that could help me understand it better?

4 Likes