When we declare a dynamic array of gameobjects. If a game object is removed from the scene the empty slot of the removed object will still remain in the array.
let's say this is our array:
var objects:Array = new Array();
and objects has gameobjects added as below:
objects[0] = go1;
objects[1] = go2;
objects[2] = go3;
if I destroy objects[1] ,then whenever accessing objects[1] it'll return null. My question is when you have a quite large array what is the efficient way of dragging out the empty slots from the array without having to go through large loops?
Cause the loop method then needs you to have a temp array to store the non-null values which it means using more memory.