Clones are still in the hierarchy after exiting play mode

Is this intentional?
If not, im Instantaiting a couple of 2D Toolkit Heart Sprites, and parenting them to the camera. For some reason when i exit out of play mode they dont get removed.

Heres the code for the instantiating, any help is appreciated!

No, it should not be doing that. Some plugins will do this by monitoring your hierarchy and re-creating the objects after you leave Play mode, but they are specifically designed to do this to save new objects created at runtime. Do you have any plugins that you are using?

Old question but I just ran into this issue myself in 2018.1:

Seems like it is caused by setting the instantiated gameobject’s parent transform directly - after instantiation. From your example:

heart.transform.parent = camera.transform;

Instead use Object.Instantiate and specify the parent transform as the second parameter:

GameObject heart = GameObject.Instantiate(healthSpritePrefab, camera.transform);
heart.transform.position = position;

And the cloned gameobjects will be deleted when you exit playmode.

I haven’t found any documentation yet as to why this is the case. If anyone knows please share. Thanks!