how to save a scene with children?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By alexzheng

I want to save a scene into a scene file, but only the parent is saved.

this is the code I use, Only a Node is save in the mynode.tscn file.

var node =
var child =
var scene =

if scene.pack(node) == OK:"res://mynode.tscn", scene)

child.owner = node

But if the the child node is loaded from a scene file and has lots of children and grandchildren, what’s the best way to set owner for each node?

alexzheng | 2018-06-18 02:09

:bust_in_silhouette: Reply From: ErdnussMaus

Still an interesting (and unanswered) question.