Quick question: if I pass a list to a method that iterates over a list as a parameter, but change the list while the iteration is running, will an error be thrown?
Example:
IEnumerator DoSomething(){
while(true){
DoSomethingElse(list)
yield return new WaitForSeconds(2);
}
}
DoSomethingElse(List<type> list){
foreach(Type t in list){
t.SomethingToDo();
}
}
Do I even need to pass the list? The idea behind this is to be able to change the list at anytime while the coroutine is running.