I am trying to make a custom list in ScrollView, but I can't manage to do it in new UI.
I have a prefab that is a Panel with 5 Text elements side by side. Now, there is ScrollView on scene with one horizontal and one vertical Scrollbar and I want to Instantiate 5 of those prefabs one below another so they look like a table.
Here is what I did, but it only instantiates them on top of each other and stretches them:
for(int i=0; i<5; i++)
{
GameObject q = Instantiate(questionObjectModel) as GameObject;
q.transform.parent = questionListHolder.GetComponent<Transform>();
}
questionObjectModel is the ScrollView on the scene (I did try to set another Panel inside and_Istantiate_ prefabs on it).
Edit:
Ok, I have managed to set them not to be stretched. Only need to set them one below another now:
q.transform.SetParent(questionListHolder.transform, false);