uGUI - Resize TextField to match Text

In uGUI - How would I go about getting a Text component resized so it fits the amount of text in it?

Is there a way to “ask” for the amount of pixels of a string, with a certain Font and FontSize?

I’m not looking for the “Best Fit” checkmark solution. I have a Font, and a FontSize the string is supposed to be rendered with - I just want the Text component to resize itself as the text-string changes.

/Andreas

Add a Content Size Fitter to the GameObject

Well, that was easy. I had no idea Preferred Size did that.

Thank you.