Here's an example of auto-sizing a text based on its content within a layout group:
https://youtu.be/p1PuVPbivGk

The important bit of knowledge is that a VerticalLayoutGroup also sizes its children *horizontally*, so put the text inside a VerticalLayoutGroup, then put that inside a HorizontalLayoutGroup with other elements, make sure "Control Child Size" is checked on everything and you're good to go.

The entire width will be restricted to the width of the HorizontalLayoutGroup.

#unity #ugui #ui

Unity UI: Sizing a text based on its content

YouTube
Hey, turns out there's an onSubmit callback and many other useful ones! It's just, they're not in the UI, you have to subscribe to those in code.
I take it all back. UGUI is awesome! Except maybe for the 90% that don't make much sense... Like when you want to make a text size itself based on its content and move other things around it according to that. Good luck finding the magic combination of checkboxes to check on a combination of Horizontal- and VerticalLayoutGroups. 😉 #unity #ui #ugui