Every time I finnish a simulation (using the Play button) in the editor, the instantiated objects remains. So if I want to test it on the device, I have to manually clean them up, otherwise these objects are built into the application (because they are in the hierarchy).
Just wondering if anyone has a simple way of cleaning up the editor?
Just have a script attached to your instantiated object that will destroy it after its been used. you can use a timer, or some sort of boolean to determine when to clean up
you should check into the script reference for: Destroy(gameObject);
Thanks for the reply :lol:
My problem is when to destroy them, since there is no event for an “editor stop” (or is there?), and Destroy/DestroyImmediate doesn’t seem to destroy them immediately.
Without that, it won’t do anything in the editor itself. it will only run in the game mode, not the editor mode
if that is what you wanted, its naturally fine.
But its still very annoying that the destroys don’t work for editor executed scripts (I’ve struggled over it when letting SpriteManager create its sprites in the editor mode so I get visual response for the GO placements)