get_simple_path(...)
is a valid function on a Navigation
or Navigation2D
node. In your code, you seem to be trying to get a reference to some kind of navigation node via:
onready var nav = get_parent()
I can only assume that the node being returned by get_parent()
in this case is not the navigation node you think it is.
You haven't shared your scene tree, but for that code to work, the above script would need to be associated with a node that is a child of the expected navigation node. I assume that's not the case here.
To check that, I'd suggest that you verify the node that's being stored in your nav
reference. This should tell you...
func _ready():
print('nav node is a ' + nav.get_class())
I assume you'll find that it's not a Navigation-type node... In that case, you need to reference the correct node.