You have to set their owner first, as per the docs:
When saving, the node as well as all the nodes it owns get saved (see Node.owner property).
You can fix this by making a simple recursive method in a new node helper class:```swift
class_name NodeUtil extends Object
static func set_children_as_owned(node: Node, owner_node: Node = node) -> void:
for child in node.get_children():
child.owner = owner_node
NodeUtil.set_children_as_owned(child, owner_node)
You can then call it right before you pack the scene withswift
NodeUtil.set_children_as_owned(get_tree().current_scene)
etc
Inherits: Resource< RefCounted< Object An abstraction of a serialized scene. Description: A simplified interface to a scene file. Provides access to operations and checks that can be performed on t...