- Home /
Destroying the original object destroys all its clones?
As the question's title would imply, I'm trying to destroy a GameObject without destroying instantiated clones of said GameObject. However, this doesn't seem to work. The clones can be destroyed, no problem, and they don't interfere with one another. However, if the original is destroyed, they all get destroyed. Here's an example of something I tried:
if(Time.time - timeToDestroy > 0 && canDestroy)
{
Destroy(gameObject);
}
The clones are not children of this object, and I have checked them, at run-time, and they are, indeed marked with the boolean field canDestroy
as false, whereas the original has it marked true (I set up a simple timing system to manage this, as is noted in the code above).
I would greatly appreciate it if someone could explain to me why this is happening, and how I could avoid it without needing to add all the components and set all the values manually, creating each individual "cloned" object by hand... Thanks!
Strange. If you put a Debug.Log() call inside the 'if' statement, do you get 1 call or a call for each object?
Why didn't I think of that... facepalm gonna go try that, now :P
Ok, so it seems they're not both being destroyed by the same destroy call... but the renderer of one is getting deactivated, I think. Thanks for the suggestion!
Your answer
Follow this Question
Related Questions
Clones of object wont disapear.. 1 Answer
Destroy the current GameObject? 7 Answers
How to remove an object from an array once it has been destroyed 1 Answer
Pick up objects 2 Answers
error in destroying bullet prefab 1 Answer