Node Script

Remove All Children

Downloads: 43
Download
Ads Support FTD

Description

Simple Node Script to remove all children from a parent

//
// RemoveAllChildren.ts
// Remove all children in a parent
// Written by @Fusedthreed – https://FusedThreeD.com
//

@customNode()
export class RemoveAllChildren extends BasicScriptNode {

  @input()
  parent: APJS.SceneObject;

  private lastTrigger: boolean = false;
  execute() {
      const children = this.parent.getChildren?.();
      if (children) {
        for (let i = children.length - 1; i >= 0; i--) {
          this.scene.removeSceneObject(children[i]);
        }
      }
  }
}
Ads Support FTD