How do I destroy a GameObject/Script that instantiates other objects, without destroying the objects it has previously instantiated?
I'm making a Danmaku type game as a project for my Unity Development class, and the devkit package I'm using (DanmakU) instantiates bullets from an emitter object. I've made one of the emitters a child of my player gameobject and I want it to be able to fire while "z" key is held. I'm able to instantiate and destroy the emitters fine, but destroying an emitter also destroys the bullets that were instantiated by it (even though they're not children), which I don't want to happen since they're not supposed to be destroyed until they're off-screen. I tried fixing this by creating a coroutine that destroys the emitter after a certain amount of time, but for some reason, calling
yield return new WaitForSeconds(10);
Destroy(<EmitterObject>);
causes the manager that controls movement and memory of all bullets to break, causing all bullets to disappear. I can provide code from the devkit if necessary. Is there a way I can destroy the emitter without destroying the objects it has previously instantiated?
Edit: Originally, I was just trying to toggle on and off instantiation with the "z" key so I wouldn't have to recreate the emitter every time, but that also caused the manager to break, so I might try using a different devkit.