- Home /
"SetDestination" can only be called on an active agent that has been placed on a NavMesh. UnityEngine.AI.NavMeshAgent:SetDestination(Vector3)
Hello im creating a game with unity2019 2.17 as you can see in topic there is an error telling me that there's no active Navmesh Agent but i've already added Navmesh Agent Component to my enemy here's error again: "SetDestination" can only be called on an active agent that has been placed on a NavMesh. UnityEngine.AI.NavMeshAgent:SetDestination(Vector3) and my code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class ZombieAI : MonoBehaviour
{
NavMeshAgent enemy;
public Transform Player;
// Start is called before the first frame update
void Start()
{
enemy = GetComponent<NavMeshAgent>();
}
// Update is called once per frame
void Update()
{
enemy.SetDestination(Player.position);
}
}
Can someone help me?
Comment