public void OnNodeDeleteChildren(BTEditorGraphNode node) { if (node != null) { BTUndoSystem.BeginUndoGroup("Delete children"); int childIndex = 0; while (node.ChildCount > 0) { BTUndoSystem.RegisterUndo(new UndoNodeDeleted(node.GetChild(0), childIndex)); node.OnDeleteChild(0); childIndex++; } BTUndoSystem.EndUndoGroup(); } }