[Solved]GameObject Destroy

So in my scene I have an GameObject called “Enemy”. It has an circlecollider with IsTrigger set Active.
I use another object to instantiate clones of the “Enemy”. And when it hit them they get destroyed.

So far so good, i got that working.

But the initial enemy is still coming at my mainplayer en when i hit it, it gets destroyed, which in result that i can’t instantiate any more enemies.

My question is. Can i set the initial gameobject as inactive or something else. So i cannot destroy the initial gameobject so it can keep on going spawning clones of these.

Or is there another way i can keep the gameobject "enemy"in my hierarchy but not in my scene?

Already found the answer.

Make a prefab in your project folder. Name it something. and drag the gameobject to it. Delete the gameobject from the scene/hierarchy.

In the script where you Instantiate your gameobject. Make a public gameobject and drag to prefab into it.

The best way to do this would be to make and instantiate a prefab rather than duplicating an object already in your scene. Check out Unity’s space shooter tutorial to see how do this:

Let me know if this helps :slight_smile: