When attempting to destroy an instance of a game object that has multiple child objects, the object remains visible on the screen unless I do the following:
private void ScheduleForDesruction(Rigidbody gameObject, float time)
{
foreach(Transform xform in gameObject.transform)
{
Destroy(xform.gameObject, time);
}
Destroy(gameObject, time);
}
Even then, there is an audio source gizmo that remains visible on the Scene view screen. Everything I've found here in the wiki regarding this indicates that calling Destroy on a game object effectively destroys all the children. This doesn't happen in my case. In fact, if I don't iterate through the entire transform array as above, the object remains visible on the screen.
Is there something I need to do differently here? Perhaps when the object is a Rigidbody, Destroying it requires different treatment? ... or when there's an audio source attached, does it have to be deleted individually?