Description
The AutoTraverseLinks
property of the NavMeshAgent
class determines whether the agent should automatically traverse off-mesh links. Off-mesh links are used to define paths that are not part of the regular navigation mesh, such as jumps or other special movements.
Usage
Set AutoTraverseLinks
to true
if you want the NavMeshAgent
to automatically handle traversing off-mesh links. If set to false
, you will need to manually manage link traversal by calling CompleteLinkTraversal
after the agent has finished traversing a link.
Example
// Create a new NavMeshAgent
NavMeshAgent agent = new NavMeshAgent();
// Enable automatic link traversal
agent.AutoTraverseLinks = true;
// Move the agent to a target position
agent.MoveTo(new Vector3(10, 0, 10));
// If AutoTraverseLinks is false, manually complete link traversal
if (!agent.AutoTraverseLinks)
{
// Assume the agent has reached the end of a link
agent.CompleteLinkTraversal();
}