Question by
EpicPurpleWalrus · Nov 27, 2021 at 04:59 PM ·
listsforeach
Why does foreach stop during a list? (reads one value only)
foreach (GameObject ball in masterCode.ballsInWord) { ball.GetComponent().ToggleLetterBall(); }
ballsInWord is a List, and the ToggleLetterBall() call removes the ball from the List. This code works perfectly fine using an array, but how do I make it work using a List? Or should I go back to an array?
Comment