Dynamically create lists and their names?
something like this, I know it doesn't work like this but so you get what I mean about how I am trying to do the names, I'm not sure how I can just make a new list from scratch and change its name.
for (t = 0; t <objects.Length; t++) {
List<GameObject> "object"+"t" = new List<GameObject>();
}
Comment
Answer by KuR5 · Jun 06, 2016 at 07:45 AM
Dictionary is a key-value pair.
So you can add element having list's name as a key and that list as a value in dictionary.
Further you can get that particular list by using respected key that is list's name in your case.
Dictionary> listDictionary = new Dictionary> (); for (t = 0; t <objects.Length; t++) { listDictionary.Add ("object" + t, new List<GameObject> ()); }