Add FontSizeRatio to Text UI Objects

I have seen multiple topics wanting more text scaling abilities, and I think a new UIElement object would appease most if not all of them.

It would be very beneficial to have a new property under Text-related UI objects that has similar functionality to TextScaled but at a fixed size regardless of content-to-textlabel wrapping.

Issues with current text scaling:

  • TextScaled property is not super controllable and your text may end up looking too large or too small depending on the content when you want it to display at a consistent size.

  • TextScaled can be unpredictable with dynamic text (such as using different Localisation strings that are much longer or shorter, or with chat messages)

  • UITextSizeConstraint has its uses, however the fact that it measures in exact pixels still defeats the purpose of correctly scaling text proportional to screen size.

The current solution to scaling text to a ratio of the screen size is through code, which in itself isn’t super complicated, it would just be a quality of life improvement, especially for beginner developers and UI Designers who aren’t versed in scripting yet.

Plus, having to use code to resize text font scale means it is not convenient to test while in the studio editor without hitting play and navigating to that part of your game, as if you want to try out another device resolution you have to input code through the command editor to preview functionality.

Font screen ratio resizing script snippet

UIFontSizeRatio functionality

It would be comprised of the following properties:

  • Ratio : number - the target percentage% of which the font scale is relative to the scaling object.

  • FontSizeRelativeTo : enum

    1. Screen - Font is scaled relative to the screen size.
    2. Parent - Font is scaled relative to the parent object it resides within.
  • FontSizeRatioType : enum

    1. X - Font is scaled relative to the target’s absolute X size.
    2. Y - Font is scaled relative to the target’s absolute Y size.
    3. XY - Font is scaled relative to the target’s absolute hypotenuse size (e.g. maximal diameter of the screen).

UIFontSizeRatio would override TextScaled, but still respect TextWrapped. In addition, there should be an alternative to TextWrapped that allows for multiple lines WITHOUT truncating excess text that fall out of the Y scale of the label.

17 Likes