- Home /
Question by
AlienClubrider · Aug 15, 2013 at 02:24 AM ·
prefabdestroyclone
I want to only destroy 3 of the clone prefabs that appear how would I do this?
if((b==h)&&(h==y)){
Destroy(GameObject.Find("BlueCube(Clone)"),3);
}
Comment
Answer by will@tactsky · Aug 15, 2013 at 03:27 AM
int counter = 0;
foreach(GameObject clone in GameObject.Find("BlueCube(Clone)")) {
Destroy(clone);
counter++;
if(counter>=3)
break;
}
The GameObject clone in does not work. Also I am using javascript.