Spawned objects are children of the spawner scene and not the main scene

I have a scene with a spawner that is separate from the main scene but when I move the spawner (rigidBody3D) in the main scene, the spawned objects move with it.

func spawn_item(item_id: String):
var item = general_item_instancer.return_item(item_id).instantiate()
add_child(item)
item.set_global_position(self.get_global_position())

Do this instead

get_tree().current_scene.add_child(item)
1 Like