Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


UpdateNavMeshData(NavMeshData, NavMeshBuildSettings, List<NavMeshBuildSource>, Bounds)

Incrementally updates the NavMeshData based on the sources.
Read time 1 minuteLast updated 13 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine.AI
  • Assembly: UnityEngine.AIModule
public static bool UpdateNavMeshData(NavMeshData data, NavMeshBuildSettings buildSettings, List<NavMeshBuildSource> sources, Bounds localBounds)

Parameters

The NavMeshData to update.

The build settings which is used to update the NavMeshData. The build settings is also hashed along with the data, so changing settings will cause a full rebuild.

List of input geometry used for baking, they describe the surfaces to walk on or obstacles to avoid.

localBounds

Bounding box relative to position and rotation which describes the volume where the NavMesh should be built.

Returns

Type

Description

boolReturns true if the update was successful.

Remarks

Each time NavMeshData is built or updated, the source data is hashed, and the hashes are stored along with the NavMeshData.
When called, first the hashes are recomputed and compared and only changed portions are rebuilt. For this reason, the list of sources should always contain all the input geometry, even if they haven't moved or changed. If the list of sources is modified between calls to UpdateNavMeshData the missing/added sources are considered changes. Try to provide the sources that have not changed since the last update in the same relative order as before because their sequence can affect the values of the hashes. This measure ensures that unchanged portions don't get rebuilt unnecessarily.
You must supply a Bounds struct for the
localBounds
parameter.
Additional Resources: UpdateNavMeshDataAsync.