I am new to the unity's latest UI. What I know about UI Text Element is, we can wrap the text with in the horizontal bounds, but if it comes to next line, either it overflows or it truncates. If it fits in the height, font size decreases. What I want is to adjust the height of the text area according to the content it contains, without affecting the font size inside.
I will be having many text elements as childs to a parent panel, the panel itself will be child to a scrollable container. So I have to calculate height of all the children to adjust the height of the parent panel.
How do I achieve it?
To insert a Text UI element in Unity, right-click on the Scene Hierarchy, then select GameObject -> UI -> Text. There are many properties of the Text element. In which Text Field is the most important property. You can type out what you want the text box to show in that field.
In unity, unfortunately, you can't increase the font size but as Dreamback told, you are always free to increase the size of text on display. First Select the Start button, Settings > Ease of Access > Display. To make text bigger screen larger, adjust the slider under Make text bigger.
Add a Content Size Fitter
component to Text
and set its Vertical Fit
to PreferredSize
.
I wrote a blog so people might find it helpful knowing how I used this component to create dynamic lists. http://mobile.folio3.com/creating-dynamic-scrollable-lists-with-new-unity-canvas-ui/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With