OK, solved it.
So I was originally having issues with "navigationserver map query failed because it was made before first map synchronization" error when setting up a NavigationRegion/Agent2D. The tutorial suggested this might happen & to use call_deferred as a solution, but I was unsure of the exact syntax. An internet search came up with the suggestion to use:
func _ready():
. set_physics_process(false)
. call_deferred("nav_map_setup")
func nav_map_setup():
. await get_tree().physics_frame
. set_physics_process(true)
This was definitely working for a while as I ran the project a few times while getting the character to face forwards while following the path. I Then found it was sometimes getting stuck on walls, so tried changing the shape of the collider which somehow got me to the issue I posted above. I am now using:
var first_physics_frame : bool = false
func _physics_process(_delta):
. if ! first_physics_frame:
.. await get_tree().physics_frame
.. first_physics_frame = true
Seems to be working for now at least! If anyone understands why the first solution stopped working for me, or knows of a better solution than the one I'm currently using, I would really appreciate you letting me know.
Sorry about the poor formatting of the code, had to use '.' to indent.