I'm no coder, and at times I'm confused with the underlying concepts of object programming.
I have a function that spawns a scene as a child of the main scene:
func spawn_location(location):
current_location = location.instantiate()
main.add_child(current_location)
location is a parameter of the object calling the function:
@export var target_scene:PackedScene
everything works fine until i try to go back to a previously visited location, in wich case i'm thrown an error:
E 0:00:00:0669 _parse_ext_resource: res://DragAndDrop/droppable.tscn:11 - Parse Error: [ext_resource] referenced non-existent resource at: res://locations/morlako.tscn
<C++ Source> scene/resources/resource_format_text.cpp:162 @ _parse_ext_resource()
looking for clues online i found this is very likely caused by a circular dependency error (which i can't understand, but guess there's a good reason for)
Assuming the problem is that, what is the correct way of dealing with it? I've read stuff online, but it's mainly workarounds (like using the filepath, that i find unconfortable and dangerous)?