Singleton class to access the baked NavMesh.
Use the NavMesh class to perform spatial queries such as pathfinding and walkability tests. This class also lets you set the pathfinding cost for specific area types, and tweak the global behavior of pathfinding and avoidance.
Before you can use spatial queries, you must first bake the NavMesh to your scene.
See also:
• Building a NavMesh – for more information on how to setup and bake NavMesh
• Areas and Costs – to learn how to use different Area types.
• NavMeshAgent – to learn how to control and move NavMesh Agents.
• NavMeshObstacle – to learn how to control NavMesh Obstacles using scripting.
• OffMeshLink – to learn how to control Off-Mesh Links using scripting.
AllAreas | Area mask constant that includes all NavMesh areas. |
avoidancePredictionTime | Describes how far in the future the agents predict collisions for avoidance. |
onPreUpdate | Set a function to be called before the NavMesh is updated during the frame update execution. |
pathfindingIterationsPerFrame | The maximum number of nodes processed for each frame during the asynchronous pathfinding process. |
AddLink | Adds a link to the NavMesh. The link is described by the NavMeshLinkData struct. |
AddNavMeshData | Adds the specified NavMeshData to the game. |
CalculatePath | Calculate a path between two points and store the resulting path. |
CalculateTriangulation | Calculates triangulation of the current navmesh. |
CreateSettings | Creates and returns a new entry of NavMesh build settings available for runtime NavMesh building. |
FindClosestEdge | Locate the closest NavMesh edge from a point on the NavMesh. |
GetAreaCost | Gets the cost for path finding over geometry of the area type. |
GetAreaFromName | Returns the area index for a named NavMesh area type. |
GetSettingsByID | Returns an existing entry of NavMesh build settings. |
GetSettingsByIndex | Returns an existing entry of NavMesh build settings by its ordered index. |
GetSettingsCount | Returns the number of registered NavMesh build settings. |
GetSettingsNameFromID | Returns the name associated with the NavMesh build settings matching the provided agent type ID. |
Raycast | Trace a line between two points on the NavMesh. |
RemoveAllNavMeshData | Removes all NavMesh surfaces and links from the game. |
RemoveLink | Removes a link from the NavMesh. |
RemoveNavMeshData | Removes the specified NavMeshDataInstance from the game, making it unavailable for agents and queries. |
RemoveSettings | Removes the build settings matching the agent type ID. |
SamplePosition | Finds the nearest point based on the NavMesh within a specified range. |
SetAreaCost | Sets the cost for finding path over geometry of the area type on all agents. |
OnNavMeshPreUpdate | A delegate which can be used to register callback methods to be invoked before the NavMesh system updates. |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.