Is there ANY function or technique I should know about that will get rid of all
of the children of a model? In my game there are different objects which are
cloned from outside the game area whenever they're needed... I've already
written a script with a FOR loop that deletes all of its children manually when
it's time to remove the object, but unfortunately some of them also have lights
as children and the lights don't get included in the list of children for some
reason (even though they definately move with the parent just like regular
children). What ...

Deleting all the children of an object

Is there ANY function or technique I should know about that will get rid of all
of the children of a model? In my game there are different objects which are
cloned from outside the game area whenever they're needed... I've already
written a script with a FOR loop that deletes all of its children manually when
it's time to remove the object, but unfortunately some of them also have lights
as children and the lights don't get included in the list of children for some
reason (even though they definately move with the parent just like regular
children). What can I do? I can't even hard-code this, since the name of the
light is different every time I clone its parent...

Re: Deleting all the children of an object

RavenWorks wrote:

> Is there ANY function or technique I should know about that will get rid of all
> of the children of a model? In my game there are different objects which are
> cloned from outside the game area whenever they're needed... I've already
> written a script with a FOR loop that deletes all of its children manually when
> it's time to remove the object, but unfortunately some of them also have lights
> as children and the lights don't get included in the list of children for some
> reason (even though they definately move with the parent just like regular
> children). What can I do? I can't even hard-code this, since the name of the
> light is different every time I clone its parent...
>

You may loop through the lights checking for their parent. If they have
as parent the node you want to delete, then you get rid of them.