guys when i attempt to get the 6th index from my array it throws me an error. why? doesn’t the array start counting at 0? so there should be 6 elements in my array.
it only gives me error for the 6th index. the rest are fine
Mhm. They do. And that’s why Balls Left
cannot be greater than 5 (or less than 0).
0,1,2,3,4,5 → 6 elements.
Perhaps the confusion stems from the numbering of the SMs. SM6 sits at Index 5.
You don’t have a 6th index. 0 → 5 = 6 entries. Arrays in all languages start at index 0.
- Index[0] = SM 1
- Index[1] = SM 2
- Index[2] = SM 3
- Index[3] = SM 4
- Index[4] = SM 5
- Index[5] = SM 6
If you want to use 1 → 6 to call a specific index, then you need to do (Balls Left - 1).
e.g. SM 4 = 4 - 1 [index 3], SM 6 = 6 - 1 [index 5], SM 1 = 1 - 1 [index 0],
yeah i got confused by the static mesh ffsss
2 Likes