- Home /
Nav Mesh Agent isn't on Nav Mesh
I am getting the error: '"SetDestination" can only be called on an active agent that has been placed on a NavMesh.' I found out that there is an active agent and that the problem is that it simply is not on the NavMesh. I have baked the NavMesh and it appears that the agent is on the mesh but I continue to get that error.
that is my object and this is my script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class Drone : MonoBehaviour { public NavMeshAgent agent; public GameObject DroneGoal; void Update() { if (DroneGoal == null) { DroneGoal = GameObject.FindGameObjectWithTag ("DroneGoalPosition"); agent.destination = new Vector3(DroneGoal.transform.position.x,transform.position.y,DroneGoal.transform.position.z); } } }
I am relatively new to NavMeshes but I was able to create working ones in the past. I do not know what is going on.