Nav Mesh SetDestination can't be called

Hi,

I have a problem with Nav Mesh. There are two scenes, the first leads into the second.

In the first scene is:

  1. A Character with a Nav Mesh Agent, and a second script from where I set the destination
  2. A walkground with a baked NavMesh
  3. A DontDestroyOnLoad() on the character and a trigger with Application.LoadLevel()

In the second scene:

  1. Another Nav Mesh
  2. A starting point object to which the undestroyed cahracter from the first scene is set, right on the Nav Mesh

When I play it, the first scene works great, the character is navigating through the entire scene. But when I come to the second scene and I click on the walkground I get this message:

"SetDestination" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.NavMeshAgent:set_destination(Vector3)

I have no idea what’s the issue. I checked if the component is active, and it’s active for sure. Also the character is just above the Nav Mesh.

Here is the code snipped, where the destination is set:

if(hit.collider.tag == walkTag){ 


 print(GetComponent(NavMeshAgent)); //prints YES, IT HAS AN AGENT
 print(GetComponent(NavMeshAgent).active); //AND YES, IT IS ACTIVE
 GetComponent(NavMeshAgent).destination = hit.point; 


}

Any advice?

I’ve got the same fun little issue :slight_smile: I’ll post here if I solve it.

I have the same issue, but it’s not possible for me to extend the navmesh… Any other possible solutions?

[Solution for your problem is here][1]
[1]: Unity - Scripting API: NavMeshAgent.Warp

But I’m still fighting with NavMesh.

  1. I 've baked NavMesh
  2. I’ve active NavMeshAgent
  3. Rigidbody is kinematic
  4. GameObject with NavMeshAgent is placed in design-time and doesn’t use any versions of transform.position =…

Still have a ““SetDestination” can only be called on an active agent…” error ((