bisketashwin
bisketashwin

Reputation: 153

Godot how to delete a RigidBody node and its child nodes?

Godot engine through gd script

I preload the tscn files and main.add_child(item). How to delete this RigidBody node and its child nodes (RigidBody node with child nodes: a sprite node and a collider shape node)?

Upvotes: 2

Views: 4820

Answers (1)

Rafał Michałuszek
Rafał Michałuszek

Reputation: 84

There isn't enough info, or just incomprehensible for me, but to delete node with it children, you just need to delete the they parent node.

get_node("your_rigid_body").free()

or

get_node("your_rigid_body").queue_free()

if you want to delete it in next frame. ( I'm not sure about the second one )

Upvotes: 4

Related Questions