Quick answer: Godot 4 NavigationRegion3D bake_navigation_mesh hanging the main thread? Bake runs sync by default - use NavigationServer3D.region_bake_navigation_mesh with on_thread=true.
Procedural dungeon. Each level bakes a nav mesh; game freezes for 800ms per level.
Use server-level threaded API
NavigationServer3D.region_bake_navigation_mesh(
region, true)Bake on a worker thread. Main thread free; nav mesh available after a signal.
Listen for completion
Connect to navigation_mesh_bake_finished. Spawn NPCs after the signal; otherwise they may path on the previous mesh.
Or pre-bake at editor time
For static levels, bake in editor. Runtime gets a finished mesh; no main-thread cost.
“Nav mesh baking is heavy. The threaded path costs nothing extra and saves the hitch.”
Show a 'preparing area' overlay during the bake. Even threaded, the gameplay can't start until NPCs have a mesh to path on.