Some of my scenes will eventually evolve. It could be a characterbody3d which will change shape, size, script, animation, skin etc or a building that will transform into another one. Anyway, what is the best practice to adopt? Should I change the components of a scene or should I create a new scene, import some parameters into the new one and delete the old scene?


Also, how does it change the choice of the type of the root node of a scene? So far I kept the staticbody3d (more generally the collsionobject3d) as the root node of a scene and it went very well, but I'm not sure whether or not I should add a default "pivot node3d" as the root node, to allow deeper changes later, so this pivot node could temporarily host 2 collisionobjects3d during the transition. I don't know, how do you do it?

When it comes to physics, change things may want to keep note of "call_deferred" and "set_deferred" when changing shapes. It's all doable. Then instead of changing node types, you'll probably want to use "add_child" and "remove_child". It's not a cheat to create a new node to replace an old node, instead of "evolving it"

Changing a root node of a scene at runtime isn't the best idea IMO because debugging that will become a nightmare (if it is even possible)

A saner way will be making a simpler Node as your root node, then evolving the stuff inside that node. Esp if you are using GDScript you can't use multiple inheritance and changing the root node type will make it incompatible with the script base class

I think it's the best idea. My impression is if an object is not being "destroyed" in game then it should not be deleted from the tree. I will add a default node3d as root to all my scenes just to be on the safe side. Thanks.

    justeleblanc My impression is if an object is not being "destroyed" in game then it should not be deleted from the tree.

    Just ignore that assumption. The user will have no clue if you switch it with a different object in 1 frame.