Is it possibile call a static var with variable name? For example call Manager.Var_ + “i”?
void PopulateList () {
foreach (var item in itemList) {
i = 1;
GameObject newButton = Instantiate (sampleButton) as GameObject;
SampleButton button = newButton.GetComponent <SampleButton> ();
button.nameLabel.text = item.name;
button.icon.sprite = item.icon;
button.button.onClick = item.thingToDo;
button.tag = item.tag;
Manager.var_ + "i" = item.var; ->> Here i need function similar to this!!!!
newButton.transform.SetParent (contentPanel);
i++;
}
}