Array confusion

Hi I’ve been re-learning arrays and came across some confusion. I want to select certain game objects in a game object array (the objects are placed in the array from the inspector) and change their position.

For example, let’s say I had 20 objects and I want to move the game objects that are EVEN in the array index. How would I go about doing that?

You can use a for() loop to iterate the array, then step by 2 instead of 1 each time.

1 Like

Thank you, I’ll try it!

Since you’re relearning arrays, I suggest spending some time with lists as well. They are far more flexible than arrays.