UIPadding.AffectsParent OR UIPadding.IgnoreList

As a Roblox developer, it is currently frustrating to work with UIPadding in certain scenarios, and I end up having to complicate my UI hierarchy.

UIPadding currently affects all siblings. But sometimes I only want certain siblings or only one sibling to be affected by the padding. To work around this, I end up having to change my hierarchy and make it more complicated than it would otherwise need to be.

It would be helpful if there was more control over which gui objects are affected. I can think of two ways to implement this, but there may be better options.

  1. Add a bool value to UIPadding called AffectsParent, that causes the UIPadding to affect its parent instead of its siblings. This would be great for when you have a series of siblings and only one needs padding. You can then parent the UIPadding to that one gui object instead of it being a sibling to all of the gui objects. In this scenario, the UIPadding would then be setting the padding for its parent within its grandparent.

  2. Add an IgnoreList property (or a WhiteList) to UIPadding that allows you set which siblings are or arenā€™t affected by the padding.

2 Likes

Remember that engineers donā€™t care about your specific proposed implementations, please just describe the problem you have that you canā€™t do/currently is too hard to do in Roblox.

Iā€™ve had this issue myself so Iā€™ll describe it :wink: (This applies to more than UIPadding constraints too.)

Iā€™ve found it really annoying having to restructure my UI when I have a constraint that only needs to affect certain children. For example, I may want to all children of a frame to have a UIPadding being applied to them, except for, say, a button that covers the entire frame. This would require you to do any of the following:

  • Make the frame itself the button (doesnā€™t solve anything if you want the button to visually cover the whole frame and its elements due to how ZIndex works).
  • Manually resize and reposition the button to fit the frame (e.g. size {1, PADDING * 2, 1, PADDING * 2} and position {0, -PADDING, 0, -PADDING}) ā€“ not good for efficiency or changing the padding value.
  • Remove the UIPadding and resize all the elements ā€“ manually not good for efficiency or changing the padding value.

None of these solutions really work that well, at least compared to, say, adding an object to an ignore list.

I think a lot of this entire system could be improved if the ā€˜constraints as componentsā€™ (or extensions to objects, instead of objects themselves) approach is taken, which I think one of the engineers said was their ultimate goal a while ago, but thereā€™d still need to specific implementation for issues like this.

3 Likes

It sounds like what youā€™re looking for is the concept of margin to complement padding. We thought about adding this at one point, but it hadnā€™t come up in any of the use cases. We can consider looking into it in the future.

I think in general responsive layout based UI requires deeper hierarchies than when you manually position things. Maybe we need to be looking at making the ā€œinvisible frameā€ pattern less awkward. On the web, nobody bats an eye when they need to wrap something in an extra <div>. I would definitely prefer to encourage invisible frames over adding ridiculous edge cases to our UI system like an ignore list property on UIPadding.

1 Like

Iā€™ve run into a similar problem where Iā€™ve had a container frame which contained a list but I also wanted to add a drop-shadow to it. It would be really nice if I could place a folder inside of the container and place the layout along with the objects inside of said folder leaving the drop-shadow unaffected.

Thatā€™s supported under the new UI backend. Layouts can be parented to folders, although constraints canā€™t.

1 Like