- Home /
foreach a array inside a generic list
[System.Serializable]
public class WeaponList {
public int index;
public string name;
public GameObject go;
public GameObject[] sights;
}
how can i "foreach" the sights ? he is inside a generic list, i've tryed that but without sucess:
foreach(GameObject sight in weapList.sights) {
}
Comment
Best Answer
Answer by poncho · Feb 18, 2014 at 02:21 AM
no foreach for you, use
for(int i=0; i< weapList.sights.Count;i++)
{
GameObject temp = weapList.sights[i];
...
}