Dear coders,
For some reason, for some reason , using the navmesh agent with the script below, my Agent keeps moving to the last seen position for the player, and not its current position. Im using 2019.4.01f. Any help would be much appreciated
public class Follow : MonoBehaviour
{
public Transform player;
NavMeshAgent nav;
// Start is called before the first frame update
void Start()
{
nav = GetComponent();
}
// Update is called once per frame
void Update()
{
nav.SetDestination(player.position);
}
}
↧