Mathias
Exalted Member
This error is bugging me it really dosnt matter as the thing i am doing works as it should but i dont want it
codeSnippet:
How would i not get the Collection was modified here? i tried a few diffrent things but dont seem to find a way to fix it
what i did find is that most people say i should change the foreach to for so its like
but i would hope there is a way to use foreach
codeSnippet:
Code:
void CurrentDeckGUI(int id) {
scrollPosition2 = GUILayout.BeginScrollView(scrollPosition2, GUILayout.Width(300), GUILayout.Height(Screen.height - 5));
List<Card> tempList = gm.currentDeck;
foreach (Card card in tempList) {
GUILayout.Label("");
if (GUILayout.Button(gm.AssignTextureToCard(card))) {
if (gm.currentDeck.Count > 0) {
gm.currentDeck.Remove(card);
gm.availableCards.Add(card);
}
}
}
GUI.EndScrollView();
}
How would i not get the Collection was modified here? i tried a few diffrent things but dont seem to find a way to fix it
what i did find is that most people say i should change the foreach to for so its like
Code:
for(int x=0;x<tempList.Count;x++)
Last edited: