So I edit an instance of a scene it my game, and I want to save the edits back to the original scene.
This question: https://godotengine.org/qa/903/how-to-save-a-scene-at-run-time?show=907#a907 enabled me to save the scene in the script. However, I have nested nodes in my scene that aren't saved.
The instanced scene of interest starts of like this:
- gun
- gun base
-sprite
- collisionObject
When I save it, it looks like:
- gun
- gun base
- sprite
- collisionObject
- newArea2d
It should look like this (notice the nested stuff):
- gun
- gun base
- sprite
- collisionObject
- newArea2d
- sprite
- collisionObject
I tried doing the 'set_owner' on the children nodes, setting the owner to be the area.
gun.add_child(new_attachment)
new_attachment.set_owner(gun)
new_attachment.get_node("Sprite").set_owner(new_attachment)
new_attachment.get_node("CollisionShape2D").set_owner(new_attachment)
var packed_scene = PackedScene.new()
packed_scene.pack(gun)
ResourceSaver.save("res://gun_new.tscn", packed_scene)
But it doesn't seem to fix it. Any thoughts?