Short Version: I want to add the children of an instanced scene as children of a parent node.
Long Version: I want a system that I can put on any node and it just works.
What is run before adding the children:
Deleting the children(done)
Why I want it:
I want to delete the children of a node when the player gets far enough and keep the parent so that I can get the old
location. (done)When the player gets back in range I want it to get the children back and add them back in. The object is instanced onto the main scene.
3. What I tried:
Preloading the scene where the object is (Instance scene) spits out Error (which can be negated by using load instead
of preload) and when I use get_child()
after instancing the loaded scene and then using add_child to add it back. It
says can't add child CHILD to PARENT. Already has PARENT_FROM_INSTANCED_SCENE
get_children()
gives me the object but after the objects children nodes are deleted the objects get deleted.
- Ideas:
- Maybe use a for loop with
get_child()
the current child number asi
as how many times it irretated through the
code. e.g.for i in get_children():
add_child(i)
(Doesn't work!)