Comparing an ArrayList to the current object in an Arraylist being checked through a forEach Loop?
foreach(ArrayList thing in spellList)
{
if(thing == spellStored)
{
Debug.Log("Found a match");
}
}
So as you can read above I am running a for each loop, it loops through an ArrayList of ArrayLists and my intention is for each ArrayList that it passes the current object should be checked against another ArrayList called "spellStored". This code does not provide any errors however it does not provide a result even when I know for a fact the spellStored ArrayList is equal to one of the Array lists the loop is passing through.
I assume this is something to do with me trying to access the current object the loop is passing through and failing although I am not sure how else I would access it other than with the name defined in the loop arguments.
Thanks in advance for any help!
Your answer
Follow this Question
Related Questions
Need help to loop an array of respawn prefabs after shooting them. 0 Answers
(c#) - For/Foreach loop skips indexes, jumping to different indexes at random?? 0 Answers
Keep track of last audio clip played from multiple arrays 1 Answer
how to check all elements in array 2 Answers
Problems with arrays (or how to rewind objects' states) 0 Answers