Skip to content

API > NavMesh


NavMesh⚓︎

Singleton class to access the baked NavMesh.

Members⚓︎

Properties⚓︎

Name Description
NavMesh.avoidancePredictionTimeProperty Describes how far in the future the agents predict collisions for avoidance.

Static Properties⚓︎

Name Description
NavMesh.AllAreas Static fieldProperty Area mask constant that includes all NavMesh areas.
NavMesh.onPreUpdate Static fieldProperty Set a function to be called before the NavMesh is updated during the frame update execution.
NavMesh.pathfindingIterationsPerFrame Static fieldProperty The maximum number of nodes processed for each frame during the asynchronous pathfinding process.

Static Methods⚓︎

Name Description
NavMesh.AddLink(link) Static fieldMethod Adds a link to the NavMesh. The link is described by the NavMeshLinkData struct. Returns an instance for the added link.
NavMesh.AddLink(link, position, rotation) Static fieldMethod Adds a link to the NavMesh. The link is described by the NavMeshLinkData struct. Returns an instance for the added link.
NavMesh.AddNavMeshData(navMeshData) Static fieldMethod Adds the specified NavMeshData to the game.
NavMesh.AddNavMeshData(navMeshData, position, rotation) Static fieldMethod Adds the specified NavMeshData to the game.
NavMesh.CalculatePath(sourcePosition, targetPosition, areaMask) Static fieldMethod Calculate a path between two points and store the resulting path.
NavMesh.CalculatePath(sourcePosition, targetPosition, filter) Static fieldMethod Calculate a path between two points and store the resulting path.
NavMesh.CalculateTriangulation() Static fieldMethod Calculates triangulation of the current navmesh.
NavMesh.FindClosestEdge(sourcePosition, areaMask) Static fieldMethod Locate the closest NavMesh edge from a point on the NavMesh.
NavMesh.FindClosestEdge(sourcePosition, filter) Static fieldMethod ocate the closest NavMesh edge from a point on the NavMesh, subject to the constraints of the filter argument.
NavMesh.GetAreaCost(areaIndex) Static fieldMethod Gets the cost for path finding over geometry of the area type.
NavMesh.GetAreaFromName(areaName) Static fieldMethod Returns the area index for a named NavMesh area type.
NavMesh.Raycast(sourcePosition, targetPosition, areaMask) Static fieldMethod Trace a line between two points on the NavMesh.
NavMesh.Raycast(sourcePosition, targetPosition, filter) Static fieldMethod Traces a line between two positions on the NavMesh, subject to the constraints defined by the filter argument. The line is terminated on outer edges or a non-passable area.
NavMesh.RemoveAllNavMeshData() Static fieldMethod Removes all NavMesh surfaces and links from the game.
NavMesh.RemoveLink(handle) Static fieldMethod Removes a link from the NavMesh.
NavMesh.RemoveNavMeshData(handle) Static fieldMethod Removes the specified NavMeshDataInstance from the game, making it unavailable for agents and queries.
NavMesh.SamplePosition(sourcePosition, maxDistance, areaMask) Static fieldMethod Finds the nearest point based on the NavMesh within a specified range.
NavMesh.SamplePosition(sourcePosition, maxDistance, filter) Static fieldMethod Samples the position nearest the sourcePosition on any NavMesh built for the agent type specified by the filter. Consider only positions on areas defined in the NavMeshQueryFilter.areaMask. A maximum search radius is set by maxDistance. The information of any found position is returned in the hit argument.
NavMesh.SetAreaCost(areaIndex, cost) Static fieldMethod Sets the cost for finding path over geometry of the area type on all agents.

Extra Detail⚓︎

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.