Select your preferred scripting language. All code snippets will be displayed in this language.
class in UnityEngine.AI
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.Close
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.Close
Singleton class to access the baked NavMesh.
The NavMesh is a class can be used to do spatial queries, like pathfinding and walkability tests, set the pathfinding cost for specific area types, and to tweak global behavior of pathfinding and avoidance.
In order to use the spatial queries, you need to first bake NavMesh for your Scene.
• 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 amount of nodes processed each frame in 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 closest point on NavMesh within 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: