- Home /
Question by
rainbow_design · Feb 26, 2016 at 06:17 AM ·
unity 5texttextfield
Fit textfield size
I have a text and i want to resize the gameobject which contains the text so it hight matches to display the text. How to do this in c#?
Comment
Answer by Fydar · Feb 26, 2016 at 03:14 PM
Add the component: "ContentSizeFilter" and change the field "Vertical Fit" to "Preferred", this will "Drive the height based on the preferred height of the layout element."
This is assuming that your text is using the new Unity UI system implemented in Unity 4.6. There is absolutely no script involved.
Source: Personal Experience and http://docs.unity3d.com/Manual/script-ContentSizeFitter.html