- Home /
How can I create a tree like list/array structure?
Ok so I have a bunch of items in an array all with the same script. each item has 4 variables that are assigned either a, b, c, or d.
like so:
public string up = a;
public string down = c;
public string left = b;
public string right = a;
I need to loop through all of the items in the array and count these variables to find out how many of each letter they contain. In this case the item contains 2 a's, 1 c, and 1 b.
Then I need to store a reference to these items in a way that i can then filter them by these counts. so that i don't have to count them every time I need a list of items... for example:
Give me all items that have 1 c, now give me all items that also have 2 a's.
I hope this makes sense. Hopefully someone can help me figure this out. I don't want to inefficiently check every item every time I need to get a list of items that match the criteria. So I'd like to store multiple arrays or lists of items based on what I already know about them by running the count once.