Problem with For Loop for Text objects,Why isn't this for loop for a list of text objects not working?
What I am attempting to do is have something occur for each item in a list of Text objects. However I cannot get the loop to execute. All the Text objects have been assigned, and I can see in the inspector that the list of Text objects has been created successfully. When I call for "ShowEndStats" - which I know is happening, since it does other things - it's not executing the for loop. Can I not do this with a list of Text objects? If not, what would the alternative be?
public List<Text> unitDisplays = new List<Text>();
public Text u1;
public Text u2;
public Text u3;
public Text u4;
void Start()
{
Text[] unitDisplayInput = { u1, u2, u3, u4 };
unitDisplays.AddRange(unitDisplayInput);
}
void ShowEndStats()
{
for(int d = 0; d < unitDisplays.Count; d++)
{
Debug.Log("Check");
}
}
Also my apologies if I've gotten technical language wrong, I'm a psychology student who is learning how to use Unity as I go.
Comment