Animals sometimes get underneath the terrain in certain areas. There is a low hill in the middle of Resource Valley where this happens often. You're walking around and hear bears barking, but can't see them. When you get to the other side of the hill the bear emerges from the edge of the slope. The agent refers to a NavMeshAgent game object that navigates the NPC on the NavMesh.
There's a couple of things that might work to remove or reduce these. NavMeshAgent has some properties that can be checked to see if it has a valid path. There are some other methods like Stop and SetDestination, but as you guessed, they aren't available when the agent is off the NavMesh. So they can't be used to put it back on the NavMesh. The thing to do is to run a timer, check NPCs for invalid path, and destroy the ones with an invalid path.
Failed to create agent because it is not close enough to the NavMesh
Failed to create agent because it is not close enough to the NavMesh
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
There's a couple of things that might work to remove or reduce these. NavMeshAgent has some properties that can be checked to see if it has a valid path. There are some other methods like Stop and SetDestination, but as you guessed, they aren't available when the agent is off the NavMesh. So they can't be used to put it back on the NavMesh. The thing to do is to run a timer, check NPCs for invalid path, and destroy the ones with an invalid path.
Failed to create agent because it is not close enough to the NavMesh
Failed to create agent because it is not close enough to the NavMesh
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.
"SetDestination" can only be called on an active agent that has been placed on a
NavMesh.
"Stop" can only be called on an active agent that has been placed on a NavMesh.