Instances not destroyed when editor is stopped

HI,

I have a NPCSquad class that is derived from a Squad class and ultimately a MonoBehaviour. The class contains a static method to create an instance of the game object with the script attached and some soldiers to populate the squad held in an ArrayList.

All works well until I stop the game in the editor when I am left with the NPCSquad and all it’s soldiers as part of the scene. When I have done this sort of thing before the instances have disappeared when leaving play mode.

Any ideas? Is there anything I should be looking out for in my scripts that might cause this?

[ExecuteInEditMode]
If your static function is being called, in the editor, right after the scene reloads (what happens when you stop play), this would put those objects into the freshly loaded scene, without the need to hit play.