How to use navigation to melee mob?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nizil

I trying use navigation2d.get_simple path and navigation2DServer.map_get_path and it returns empty array.

:bust_in_silhouette: Reply From: smix8

Both will return empty when you a) have no navigation mesh on the map b) you are calling the functions to early before the NavigationServer had time to sync, e.g. you are calling in a _ready() function while half the SceneTree is not even done loading. The NavigationServer syncs map changes on the physics frame so you need to at least wait one physics frame before you can query a path.