Could come from here, root is the main window (I think), does this only happen when you exit? root is deleted when you exit, changing the scene is not possible.
Thanks Alex—do you know what set_current_scene does? Is it not finding root?
Looks like it errors every time I change levels, after I’ve loaded the scene. I remove the last one, then I add_child. get_tree().set_deferred might trigger this error? Root never leaves. Shouldn’t, anyway It seems to be serving up levels as expected, and I’ve double checked the tree looks right. Hm…why the error?
# Set it as the current scene, only after it has been added to the tree
get_tree().current_scene = instanced_scene
I think this is how the C++ function is executed, does this demo help you? Or do you already have something similar and the errors are still displayed?
I wasn’t even aware of change_scene_to_file() (and should look into it!)
Mine is more complex with transitions and so on, but it swaps out grandchildren, so maybe that helps explain the error. Now I’m wondering if I’m using something other than change_scene_to_file() that still hits set_current_scene(), which expects to be working directly under the root. Not sure why everything works fine, then…
<time passes>
Aha! I had get_tree().set_deferred(“current_scene”, content). It’s undesirable in my case, since I’m swapping at the grandchild level. It shouldn’t have even been there since my my level has already swapped. So, it could error, but everything looked right anyway.