Attention | Topic was automatically imported from the old Question2Answer platform. | |
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 = Node.new()
var child = Node2D.new()
node.add_child(child)
var scene = PackedScene.new()
if scene.pack(node) == OK:
ResourceSaver.save("res://mynode.tscn", scene)
add
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