X can only be called on an active agent that has been placed on a NavMesh.

I’ve used nav mesh agents without any problems before but it just keeps repeating this error now and I’ve already been checking the same things 10 times over.

  • The agent is on a nav mesh (above it)
  • I already baked the nav mesh, the plane is static and the blue indication is showing
  • agent is set to humanoid
  • Also tried putting the agent a little bit higher or a lot higher but with the same result.
"GetRemainingDistance" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
BehaviorDesigner.Runtime.Tasks.Movement.NavMeshMovement:HasArrived () (at Assets/Behavior Designer Movement/Scripts/Tasks/NavMeshMovement.cs:104)
Opsive.DeathmatchAIKit.AI.Actions.SearchForTarget:OnUpdate () (at Assets/Opsive/DeathmatchAIKit/Scripts/AI/Actions/Attack/SearchForTarget.cs:97)
BehaviorDesigner.Runtime.BehaviorManager:RunTask (BehaviorDesigner.Runtime.BehaviorManager/BehaviorTree,int,int,BehaviorDesigner.Runtime.Tasks.TaskStatus)
BehaviorDesigner.Runtime.BehaviorManager:Tick (BehaviorDesigner.Runtime.BehaviorManager/BehaviorTree)
BehaviorDesigner.Runtime.BehaviorManager:Tick ()
BehaviorDesigner.Runtime.BehaviorManager:Update ()

What else is there left to check?


Do you know there’s a dedicated Navigation forum? I’ll move your post there for you.

Alright thanks

The most likely sources of this error are:

  • you are trying to tell the prefab where to go. You need to tell the Instantiate()-ed thing where to go. Instantiate() returns a reference to the thing you instantiated

  • you are telling a disable navmesh agent to go somewhere. This won’t work.

Mh I tested some values in the terminal and it prints

navMeshAgent.isOnNavMesh
false
navMeshAgent.isActiveAndEnabled
false
navMeshAgent.isPathStale
false
navMeshAgent.isStopped
false

navMeshAgent
{Nolan (UnityEngine.NavMeshAgent)}

navMeshAgent.gameObject.scene.name
gameObject.scene.name

Ah nevermind the nav mesh agent is being disabled by something on runtime, I bought some asset and followed along with the instructions but it seems like something went very wrong.