I’m trying to have a GameObject clone itself, and after a certain number of reproductions, the object dies via Destroy(this.gameObject)
. However, when I do this, it destroys itself as well as ALL instantiated object. How do I have the Destroy method only apply to the object it is invoked on, and not any of its instantiated clones?
I an destroying the object with Destroy(this.gameObject);
, and cloning it with the folloowing code:
GameObject offspringObject = Instantiate<GameObject>(this.gameObject, this.rigidBody.transform);
I’ve also tried using a prefab in place of this.gameObject
for cloning, but the children are still all destroyed.