Could some one please help me find some code that shows how to add prefab items to scroll view though code.
Also manage changes to items in the scroll view.
Mike
Could some one please help me find some code that shows how to add prefab items to scroll view though code.
Also manage changes to items in the scroll view.
Mike
I figured it out, here is a simple example
//Cards is an array of data
for (int i = 0; i < Cards.Count; i++)
{
//ItemGameObject is my prefab pointer that i previous made a public property
//and assigned a prefab to it
GameObject card = Instantiate(ItemGameObject) as GameObject;
//scroll = GameObject.Find("CardScroll");
if (ScrollViewGameObject != null)
{
//ScrollViewGameObject container object
card.transform.SetParent(ScrollViewGameObject.transform,false);
}
}