+1 vote

I made a scene and added already a lot of stuff to it but i realize i forgot my rigidbody2d and i can't reparent a parent so i want to just move the children to my rigidbody2d but i dont know how
Pls help

in Engine by (395 points)

1 Answer

+2 votes

In the editor you can right click and Change Type for the parent's Node type if that is easiest.

To move the children, just create the new parent node, select all the children and drag them into the new node. From there if you want that parent to be a root of the scene, you can right click and Save Branch as Scene.

If you're talking about in code, you have to remove the child from the parent first, then add to the new parent.

Something like:

var parent = self
var child = get_node("child_to_move")

var new_parent = get_parent().get_node("new_parent")

by (5,232 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.