Can't set a parent for node even if it doesn't have a parent (error)

Godot Version

4.2.1

Question

Hi! I have problem, maybe it’s a godot bug or I am doing something wrong :confused:

I want to change a parent for an item (Node2D).
The item is in InventoryComponent Node2D, and after selecting it (for example clicking) I want to move the item to different node (SelectedItemHand Node2D), but I got an error:


The error says that item “IronSwordItem” has already a parent, but when I try to log parent, I got null


So it’s dead end for me for now, what am I doing wrong?

Because you’re supposed to use AddChild() when moving Nodes around.

I don’t quite understand :face_in_clouds:

Excuse me, I meant MoveChild() or Reparent()

1 Like

Alright, I’ll check this method then

Heh, Reparent works for me, thanks!
Didn’t know about this method need to check more Node methods: Node — Godot Engine (stable) documentation in English

Thank you again!