- Home /
Everytime I alter code during runtime my lists break
I'm using a list to store my enemy base class (which I derive actual enemies from) any time I change my code (including adding a space then deleting it) when I save and return focus to Unity I get the error "ArgumentOutOfRangeException: Argument is out of range. Parameter name: index. I do a bit of snooping and find that my list still says it has an enemy in it (count = 1) but when I inspect that element with the watch I find the enemy is replaced by an error message "Unknown type " System.Collections.Generic.CollectionDebuggerView`1, mscorlib.dll'" What's happening?
When coding at runtime, once the code has compiled, it resets all the variables
It only causes issues with my list, it doesn't reset my position, or my health or any other variable.
I believe it resets everything that isn't an inbuilt type... like a list
Your answer
![](https://koobas.hobune.stream/wayback/20220613094308im_/https://answers.unity.com/themes/thub/images/avi.jpg)