- Home /
Arrays rebels to my power!
I'm trying to understand why this happens!
I declare an istance array of strings, "ds"
var ds = new String[5];
It was 4 some time ago, and it worked, but now I had to change it to add a variable, I changed the for cycle, to do one iteration more, but it doesn't work anymore!
for (i = 20 ; i < 25 ; i++)
{
ds[i-20] = lines[i];
}
It gives me "IndexOutOfRangeException: Array index is out of range. (wrapper stelemref) object:stelemref (object,intptr,object)", but that's impossible, lines[i] works because I tryied it with Debug.Log, while ds[4] no, even if the array has 5 elements... (I tryed to write 3000000 but it doesn't work anyway)
It's a bug of Unity or it's just me?
Answer by SalvoSoftware · Dec 06, 2013 at 06:54 PM
Fixed, I just renamed the variable, that's very strange, it must be an Unity's bug...
Your answer
Follow this Question
Related Questions
Index out of range exception - C# - Can't find the problem 1 Answer
Array index is out of Range!? 1 Answer
What means this error ? 1 Answer
array problem index out of range ? why ? 2 Answers
Wierd Animation Bug 0 Answers