I have a pretty complex project that I have been building in parts, and I have just connected my scene for generating planets to the one that manages the wider space, such that the Space scene instances a child of the Planet scene, sets its parameters, then gets it to generate a planet surface. To quit back from the Planet scene to the Space scene, there is a button on the Planet scene that calls queue_free(). I change the active camera between the scenes (and the world environment, though I'll probably move that to be local to each camera instead). Most of the time this works fine, but sometimes after I have opened then closed several planets, the project will crash, generating the following error to the output window:
ERROR: _logic_balance: FATAL: Condition "A->num_children != 2" is true.
I tried googling this, but couldn't seem to find anything. Is there anyone out there familiar with the internals of the Godot engine enough to give me some hint on what might be going on here, or where to start looking? Being that it's part of a relatively complex project, it's probably not going to be easy to get a minimal test project if I'm not even sure what part(s) of the code are causing it. I did wonder if maybe I was leaving a file open somewhere, or doing something wrong with freeing resources, but couldn't see anything wrong when I looked for these.
Not sure if it's relevant, but occasionally I spot a minor graphical bug in the Space scene before it crashes (a strip of some stars [PointMeshes] disappear momentarily), and the opening/generating of a Planet scene will take longer if it is going to crash - as if it's getting stuck on something before it fails.
Any pointers on where to start with solving this?
I looked at the code listed (core/math/bvh_logic.inc) but the only help that gives is that it is apparently to do with physics logic. I do use raycasting into the 3d world in both scenes, so could it be something like that breaking with a half-built scene? I have no idea what part of my code would be hitting this, as its not giving me any friendly Godot error that would help in debug tracing, it just exits.