Why Original GameObject Destroy Clones ?
Hello EveryOne ... So i'm making a 2D Game in Unity Using C# ... i have a Game Object .. where i make a lot of clones from it ... when one of these Clones including the Original One go Invisible .. i destroy it .. The problem is that when i Destroy the original gameobject all the others get destroyed .. and i can't spawn anymore :/
here is the spawner ;
public void spawner()
{
i++;
bars.Add( (GameObject)Instantiate(blocks, transform.position, Quaternion.identity));
Debug.Log("Spawned"+i);
}
and the destroyer : void OnBecameInvisible() { Destroy(this); }
Thanx
Comment
Because the original holds all of the objects in a list, if you destroy the original, the script is removed and everything is gone.
Try spawning them from an empty gameobject ins$$anonymous$$d.