My Problem is Text Component Size is not Adjusting.
For the sake of Understanding :
void Start()
{
goParagraph = new GameObject();
RectTransform rectOfText = goParagraph.AddComponent<RectTransform>();
Font myFont=(Font)Resources.Load("Fonts/Karmakooma_copy",typeof(Font));
Text txtParagraph = goParagraph.AddComponent<Text>();
txtParagraph.text = "Let"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog"
+ "The quick brown fox jumps over the lazy dog";
txtParagraph.font = myFont;
goParagraph.transform.SetParent(parent.transform);
rectOfText.anchoredPosition = new Vector2(0, 0);
}
So it gives the result :
It takes the Height and Width properties to adjust the size of text block but expecting is it should adjust their height as content bigger like this :
One thing just for the sake of question i small the font which is not matter for my question like we can set font by c#.