# Nav Mesh Baker Component

The core of the package is the _**Nav Mesh Baker**_ component. The component is shown below and as you can see, is well documented.

The TLDR for the logic for _**Runtime Navmesh Baker**_ is that it will regenerate a navmesh of size ‘Nav Mesh Size’ around the ‘Player’s position every ‘Update Rate’ seconds IF the player has moved more than ‘Move Threshold’ meters in the world.

The full Runtime Navmesh Baker inspector is shown below:

#### ![](https://1421570450-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOX9qdO02HF8IWzQVSI2Q%2Fuploads%2Fh7hh6Z6A7PEKWe1QLsto%2F3.png?alt=media) <a href="#zdq3njlach2z" id="zdq3njlach2z"></a>

To use, simply:

1. Create an empty game object
2. Add the _**‘Nav Mesh Baker**_’ component
3. Adjust desired properties (documented below)

## Properties

More details about each of the properties are listed below

### **Auto Initialize (bool)**

Should the navmesh baker start running automatically when the scene loads? If set to false, you **must** call Init() yourself to start the baking. See NavMeshBaker API

### **Player (Game Object)**

_**Runtime Navmesh Baker**_ generates a navmesh in the local area around the player. Add a reference to the player in your scene.

### **Update Rate (float seconds)**

This variable controls how often _**Runtime Navmesh Baker**_ should check if it needs to regenerate the navmesh. The value is in seconds. It is used together with the Move Threshold to determine whether the navmesh should be generated.

### **Move Threshold (float meters)**

This variable controls how _**Runtime Navmesh Baker**_ generates the navmesh. In order to optimize how frequently the navmesh is generated, you can use this variable to determine how far the player must move before we need to generate a new navmesh.

### **Nav Mesh Size (Vector3)**

You can adjust the size of the navmesh that is generated with this property. Click ‘**Bake Local Navmesh**’ (see below) to preview the size of the navmesh that is generated.

### **Write Debug Logs (bool)**

You can optionally tell the Navmesh Baker to write logs to the Unity console. If unchecked (default), then no logs will be written.

## Buttons

### **Clear**

If you have baked a local navmesh (see below), this button will clear the results. Note: navmeshes baked in Edit mode are temporary and will be reset when entering playmode.

### **Bake Local Navmesh**

Click this button to generate a dynamic navmesh in the Editor. This can be used to preview the navmesh size during development and can also be used to create a ‘pre-baked’ navmesh that will be present immediately when your scene loads.

This can be useful if you have NavMeshAgents in your scene at load time and want to avoid getting errors that they are not present on a valid navmesh (for example if you get error / warnings like _**Failed to create agent because there is no valid NavMesh**_ on scene load)
