I’m create panel for scrolling text objects. Texts instantiate runtime from prefab. I have hierarchy
Content object has attached component VerticalLayoutGroup. Code for adding texts
for (int i = 0; i < 10; i++)
{
GameObject inst = (GameObject)Instantiate(textPrefab);
inst.GetComponent<Text>().text = contentString;
inst.transform.SetParent(layoutGroup.transform, false);
}
Result view:
Texts don’t wrap horizontally and VerticalLayoutGroup rect don’t fit to texts sizes.
But i need get view something like this
Describe steps for creating dinamically added texts to scroll, please