- Home /
How can I check if an array slot of empty game objects is empty?
I've got my array of empty GameObjects where I instanciate prefabs.
var posicion_de_globos : Transform[];
And after being creating some instances (clone) these instances (clones) selfdestroy after a few seconds:
Destroy(clone,dificultad);
Well, how I was instanciating my "clones" in this array of positions I wanted to displace the newer objects who still are alive to one position more to the left, occuping the position of the "clone" recently dead. It's like a queue where the objects introduced by the left dead by the left too...Do you know what I mean?. The fact is that first I've got to check if the clone positioned to the left has died and then move one position to the left all the clones.
The question is:
if(posicion_de_globos[0]==null)
Is well done?...I've put a print("dfdfs") to debug and check if my script enters but nothing...It can enter in teh for loop which displaces the rest of the clones one position to the left.
Answer by jorgon · Oct 13, 2011 at 11:05 AM
Let me selfanswer:
if(posicion_de_globos[0].tag!="clone")
I can enter in. So I think the problem is solved.