Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

NavMeshAgent.SetPath

Suggest a change

Success!

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

Submission failed

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

Cancel

Declaration

public bool SetPath(NavMeshPath path);

Parameters

Parameter Description
path New path to follow.

Returns

bool True if the path is successfully assigned.

Description

Assign a new path to this agent.

If you successfully assign the path, the agent resumes movement toward the new target. If the path cannot be assigned, the path is cleared (see NavMeshAgent.ResetPath). A path that was calculated for a different agent type than this agent's NavMeshAgent.agentTypeID is ignored: the method returns false and the agent keeps its current path. Use NavMeshAgent.CalculatePath or NavMesh.CalculatePath with a NavMeshQueryFilter to obtain a path for this agent type.