> For the complete documentation index, see [llms.txt](https://megacrush.gitbook.io/megacrush-unity-assets/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://megacrush.gitbook.io/megacrush-unity-assets/runtime-navmesh-baker/runtime-navmesh-baker-user-manual/package-elements/components/baker-coordinator.md).

# Baker Coordinator

The **BakerCoordinator** is the single entry point for runtime navmesh baking. It replaces the legacy `NavMeshBaker` and manages the `NavMeshBakerService` internally.

> Create a Baker Coordinator in the scene by going to `GameObject -> Runtime Navmesh Baker -> Add Navmesh Baker`

<figure><img src="/files/B29JQkgXQzHjXYsspbpg" alt=""><figcaption></figcaption></figure>

### Overview

* **One entry point** that creates and manages the `NavMeshBakerService`
* **Profile-driven** via `NavMeshBakeProfile` (mode, size, thresholds, agent types, area costs)
* **Bake Modes supported:**
  * *Continuous AABB* — moving bubble around a target
  * *Grid Cells* — streaming window of fixed cells
  * *One Shot* — full-scene bake once at startup
* **Center Target** (player, camera, or any transform) drives where Continuous AABB and Grid Cells bake
* Works with any number of `DynamicNavMeshSurface` components in the scene
* Exposes runtime controls, bake queue stats, and diagnostics in the inspector

***

### Typical Setup

1. Menu: `GameObject → Runtime Navmesh Baker → Add Coordinator`
2. Create/assign a `NavMeshBakeProfile`
3. Set **Center Target** (player or main camera) — required for Continuous AABB and Grid Cells; optional for One Shot
4. Ensure bakeable areas use `DynamicNavMeshSurface`
5. Enter Play Mode

***

### Inspector Reference

#### Properties

* **Profile**\
  Reference to a `NavMeshBakeProfile`. Defines bake mode (*Continuous AABB*, *Grid Cells*, *One Shot*), sizes, thresholds, intervals, agent types, and area costs.
* **Center Target**\
  Transform to follow when computing bake volumes or selecting grid cells.\
  *Not required in One Shot mode.*
* **Service Panel**\
  Shows the `NavMeshBakerService` owned by this coordinator.\
  If missing, a warning appears with **Add Service Component** (advanced; normally not needed).\
  Displays runtime metrics (Play Mode only):
  * **Queued / In-Flight / Skipped(no-src)** — job queue state
  * **Update p95 / Collect p95 / Schedule p95 (ms)** — 95th percentile timings for each stage

#### Actions

* **Start Baking** — Starts the coordinator’s baking flow (initial enqueue + runtime updates).
* **Bake All Now** — Forces a full pass across all registered surfaces immediately.
* **Enqueue Current Grid Cells** — Enqueues the active cell and rings around the center target.\
  *Enabled only if profile mode = Grid Cells.*
* **Run One Shot Bake** — (new) Immediately triggers a single full-scene bake when profile mode = One Shot.
* **Open Bake Monitor** — Opens the Bake Monitor editor window for a live, multi-surface view.
* **Select Service** — Focuses the owned `NavMeshBakerService` GameObject in the hierarchy.

***

### Public API (Coordinator)

```csharp
void SetProfile(NavMeshBakeProfile profile);
void SetCenterTarget(Transform target);
void StartBaking();
void BakeAllNow();
void RunOneShotBake();     // new in 1.4.0
NavMeshBakerService GetService();
```

***

### Best Practices

* Keep **one BakerCoordinator per scene**.
* Use **Profiles** to switch between modes:
  * *Continuous AABB* → compact/roaming maps
  * *Grid Cells* → large/procedural/streaming maps
  * *One Shot* → handcrafted maps where you want one full bake at runtime
* Use the **Bake Monitor** during development to track throughput, hotspots, and job queue health.
* For spawner workflows, combine placement policies (*Require*, *Prefer*, *Ignore*) with the bake events exposed by the coordinator to ensure AI is placed only after valid navmesh is available.
