Can you cancel baking of navigation meshes?

Godot Version



My script will occasionally try to bake a navigation mesh before the last baking is complete. (I’m not doing anything insane like putting bake_navigation_mesh() in _process)
The editor shows me this error:
NavigationMesh is already baking. Wait for current bake to finish.

Is it possible to cancel the current bake and start over? Alternatively, can I defer the new bake to start after the old bake is done?

To be more specific, I have a game where objects are moved around. Each time an object is placed on the ground, the characters need to navigate around it. If something is dropped or moved in rapid succession, it will try to bake again before the last bake completes. It would be nice if I could cancel a bake.

By using bake_navigation_mesh(false), I’m no longer using the default of baking the navigation mesh on a separate thread. That seems to make the error go away, but I’m still not sure exactly what the behavior is. Is it cancelling and starting over?

You can not cancel a started bake but you can check with the is_baking() functions on regions or server if a navigation mesh is still baking to avoid causing the error.