Im a bit embarrassed to post for such a little problem, but I can’t find a solution.
I made a control class for boxes. I want the box to detach when a condition is met.
I get the node with a getter, and then do node.detachChild(spatial);
This doesn’t work. If I do node.detachAllChildren(), it works as expected.
I would agree with aegroto, although it could be the wrong node that you’re trying to detach from. For instance if you have rootNode → node → box and you try to do rootNode.detachChild(box) it won’t work, you would need to do rootNode.detachChild(node) or node.detachChild(box). Or you could just do:
Glad you got it fixed up! Nothing to be embarrassed about, mistakes are so common in coding they have their own name, bugs
Read an article not that long ago that suggested if it weren’t for bugs many programmers might find themselves out of a job since so much time is spent doing little more than fixing them.