Skip to content

Instantly share code, notes, and snippets.

@andrew-wilkes
Last active November 22, 2022 11:27
Show Gist options
  • Save andrew-wilkes/cb1c1eedc100766a8a584c4bc925b615 to your computer and use it in GitHub Desktop.
Save andrew-wilkes/cb1c1eedc100766a8a584c4bc925b615 to your computer and use it in GitHub Desktop.
var target = get_node("new_parent_node")
var source = get_node("child")
self.remove_child(source)
target.add_child(source)
source.set_owner(target) # I think that this line of code is only needed in Editor scripts
@andrew-wilkes
Copy link
Author

Use the move_child method to simply reposition a child node amongst its siblings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment