I am trying to figure out how to generate an scrollview from c#. I have made an GameObject as ScrollView and attached an grid. I have then made an prefab sprite which I want to copy/clone into my scrollview, but it is not working. Is there anything I am missing?
Here is how I have done so far:
public GameObject listGrid;
public GameObject listItem;
These 2 holds the grid object and the prefab.
for(int i = 0;i < 3;i++){
GameObject insObj = Instantiate(listItem) as GameObject;
insObj.name = "listobject"+i;
insObj.SetActive(true);
insObj.transform.parent = listGrid.transform;
insObj
.transform.localScale = new Vector3
(1,
1,
1);}
This generates the list items, but they do not get in order below each other... The all is placed the same place?!?!
Hoping for help and thanks in advance :-)