How to horizontally scale a Text element from a script?
I have a prefab that holds an empty Text component.
When needed, a new clone is made that takes data from a database to fill in the blanks of the prefab.
This works fine but some words get cut off when the Text is too large to fit in the rectangle I need it to fit in.
I want all of the text to show up and not get cut off.
I know about best fit but that one scales both vertically and horizontally and ends making the text hard to read.
Is there a way for me to scale the Text from the same script that initializes it depending on how large it is?
Your answer
![](https://koobas.hobune.stream/wayback/20220613012421im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Player Prefab scale automatically goes to 1 x 1 x 1 whereas I have set it to 0.48 x 0.48 x 0.48 1 Answer
Content Size Fitter should scale only in one direction 0 Answers
Scaling a text to fill 50% of screen width and 50% of height, no matter whats inside C# 0 Answers
If statement not getting called after Lerping a Scale 1 Answer
why did the script change 0 Answers