Give developers a way to get the raw size of a GuiObject before UIScale's scaling is applied

Currently it is impossible to natively get the raw size of a GuiObject that has been altered with UIScale. AbsoluteSize seems like the correct candidate for this, but it does have its limitations (in relation with UIScale, shown in the example).

Example

  1. you are creating a notification system, and therefore want to place TextLabels on under each other
  2. the TextLabels can have different text, meaning they can have varying sizes and therefore a predetermined size cannot be determined. The Size property won’t work as it will not change with AutomaticSize. AbsoluteSize will have to be used to get the size of the TextLabel
  3. you want to be able to animate the text labels into place, therefore UILayouts cannot be used as they cannot be animated
  4. you insert a UIScale instance to scale the UI so your code is able to scale it relative to the screen size

With a scale of 1, everything seems to be working perfectly:

image

It’s a different story when the scale is 2:

image

Workarounds

  • find all instances of UIScale that is impacting the size of the gui (tedious)
  • don’t use UIScale (doesn’t work with many workflows)
  • use text service to retrieve the text bounds of text (doesn’t work with rich text, only works on text objects)

Proposed solutions

A property that tells you how much the GuiObject is being scaled.
A property or method that retrieves the size of the GuiObject before UIScale is applied

5 Likes

This is crucial when working with AbsoluteSize. If this is biased by UIScale, it’s not feasible to use this value when setting the size of something inside of that object. The sizes will overshoot and undershoot, which is never a good thing!

Making dropshadows that are slightly bigger than its container are a use case for this. You’d need to make a function to get the total scale to get around the problem. That’s not efficient and not user friendly!

This is still a problem.

I would also suggest adding an AbsoluteUIScale property or similar.

3 Likes