# NavMeshBakeProfile

## Runtime Navmesh Baker — Bake Profile

The **Bake Profile** (ScriptableObject) configures how the runtime baker chooses bounds, collects sources, throttles work, and stitches seams.\
Assign a profile to your **BakerCoordinator / NavMeshBakerService** to control runtime baking.

Create one via:\
`Assets → Create → Runtime Navmesh Baker → Bake Profile`

***

### What profiles are good for

* Keep multiple configurations (e.g., Open World, Dungeon, Arena).
* Tune behavior without changing code.
* Share consistent settings across scenes.

<figure><img src="https://1421570450-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOX9qdO02HF8IWzQVSI2Q%2Fuploads%2FCon8D3WoBM3of0MwcVEi%2F2025-09-07%2014_16_00-D__projects_Asset%20Store%20Package%20Dev%20-%201%20-%20Simple%20NavmeshBaker%20Demo%20-%20Windows%2C%20Ma.png?alt=media&#x26;token=5f435549-cb9c-49b1-b4ad-670cca7ab80b" alt=""><figcaption></figcaption></figure>

### Overview

* **Bake Mode** – Continuous AABB, Grid Cells, or One Shot
* **Update Triggers** – follow target & poll cadence (where applicable)
* **Continuous AABB** – moving AABB “bubble”
* **Grid Cells (Window)** – fixed-size cell window
* **One Shot** – bake the entire scene once at startup
* **Motion Gating** – optional speed gates
* **Concurrency & Throttling** – job limits
* **Source Collection** – geometry/layers/default area
* **Agent Types & Area Costs** – per-area traversal
* **Seam Links** – optional links across tile edges

***

### Inspector Reference

#### Mode

**Bake Mode**

* **Continuous AABB** – moving bounding box around target.
* **Grid Cells** – rings of fixed cells around target (3×3, 5×5, …).
* **One Shot** – bake a single large navmesh covering the entire scene once at runtime.

***

#### One Shot

Use **One Shot** when you want a full navmesh built once at startup, without continuous or incremental updates.

**Settings**

* **Base Bounds Size (XYZ)** – defines the full extents of the bake volume (should cover your whole map).
* **Auto Start** – if true, begins baking automatically at runtime.
* **Trigger Mode** –
  * *Manual*: call `BakerCoordinator.EnqueueBake()` to start the one-shot bake.
  * *Auto*: bake starts immediately on Awake/Start.
* **Rebake Behavior** –
  * Default: no rebakes scheduled.
  * Optional: expose manual rebake events if the map changes dynamically.

**Notes**

* Works best for large handcrafted maps where the navmesh doesn’t need to stream or follow a player.
* Use `OnBakeCompleted` to synchronize agent spawning after the one-shot bake finishes.
* Consider memory usage: the entire navmesh is generated in a single data set.

***

#### Continuous AABB

* **Move Threshold (m)** – re-bake after the center moved this far.
* **Base Bounds Size (XYZ)** – AABB size around the center.
* **Moving Rebake Interval (s)** – minimal time between moving bakes.
* **Use Velocity Lead / Velocity Lead (m)** – bias AABB in the motion direction.
* **Edge Rebake Margin (m)** – re-bake if center nears the edge of last AABB.

***

#### Grid Cells (Window)

* **Cell Size XZ (m)** – cell dimensions on X/Z.
* **Cell Height (m)** – vertical extent of each cell.
* **Cell Rings** – rings around current cell (0 = current; 1 = 3×3; 2 = 5×5).
* **Cell Rebake Interval (s)** – minimal time between cell updates.
* **Cell Hysteresis (0–0.9)** – “stickiness” to avoid thrashing near borders.
* **Window Y Slab Height (m)** – vertical slab baked for the window.
* **Window Overlap Padding (m)** – extra XZ padding for polygon overlap.
* **Quantize Window To Voxel** – align window to voxel grid to reduce cracks.

***

#### Concurrency & Throttling

* **Max Concurrent Bakes** – upper bound for parallel jobs.
* **Min Seconds Between Bakes / Surface** – per-surface throttle. In combined mode, applies globally per-agent.

***

#### Source Collection

* **Collect Geometry** – Physics Colliders / Render Meshes.
* **Layer Mask** – included layers.
* **Default Area** – fallback NavMesh area index for collected sources.

***

#### Agent Types & Area Costs

* **Agent Type IDs** – explicit agent types to bake (empty = use each surface’s agent type).
* **Area Costs \[0..31]** – per-area traversal costs (-1 leaves unchanged).

***

#### Seam Links (Tile Edge Portals)

(unchanged; applies only when Grid Cells + Combine Tiles = OFF)

***

### Best Practices

* **One Shot** for handcrafted maps where you want the navmesh built once at runtime.
* **Continuous AABB** for compact maps or “bubble around player” setups.
* **Grid Cells** for streaming/procedural worlds; add Seam Links if not combining tiles.
* Keep **pollRateSeconds** between 0.1–0.25 s for responsive updates without spikes.
* Cap **maxConcurrentBakes** to match CPU budget.
* Use **areaCosts** to nudge pathing (e.g., roads cheaper, hazards more expensive).
