hey there, iam new in unity and dont know how use more then one list
public class Mylist : MonoBehaviour
{
[SerializeField] public List<Mylist_Data> datlist= new List<Mylist_Data>();
void Start()
{
gen_zrlist();
}
void gen_zrlist() {
datlist.Add(new Mylist_Data(0, "test"));
}
}
i will make datlist[0], datlist[1], datlist[2] but dont know how i should read that…
can anybody help me pls?
and the 2. problem is how can i have arrays in list struct like this:
[System.Serializable]
public struct Mylist_Data
{
public int ID;
public string name;
//public int[] numbers=new int[12];
public Mylist_Data(int ID, string name, int[] numbers)
{
this.ID = ID;
this.name = name;
this.numbers=numbers;
}
}
datlist.Add(new Mylist_Data(0, “test”, array_numbers));
is not working, how can i read it correct?