- Home /
How to iterate through array?
Hi guys, today i have been trying to change the index of the array if the previous one has been destroyed. I have an Array of game Objects and this objects get destroyed every 3 seconds, but I want to destroy the element 0 of the array, then once destroyed, keep going with the second, third etc...
I was trying to do it using index++ everytime one gets destroyed but I couln´t got it working.
Any help is appreciated guys.
Comment
Answer by DaveA · Oct 03, 2012 at 07:00 PM
You should look into using a List or Queue instead. Sounds like you want to 'Pop' But if you must use array, the built-in arrays do not resize. You should edit your question to post your code.